8
zshh
7y

Share your own useful terminal aliases here:

- grm=git rebase origin master
- gforbm=git fetch origin && git rebase origin master
- vm=vim Makefile
- idea=vim ~/repos/ideas/README.md (where I store all my programming ideas)

Comments
  • 4
    cdls is my favorite by far
    I actually can't believe it isn't a builtin.
  • 1
    @Ashkin nice. Could you write the whole command?
  • 7
    bd = cd ..
    iwant = sudo apt-get install
    bye = exit
    gs = git status
    gp = git pull
    gcm = git checkout master
    test = /var/www/html/test

    Etc.... I have lots of alias to fasten things...
  • 8
    @zshh it's a bash function, actually, not an alias.

    In ~/.bash_profile (or similar):
    function cdls {
    cd $1
    ls
    }

    Couldn't be any simpler.
  • 2
    @Ashkin Awesome, and I learned you don't even need the alias when you're defining a function. TIL :)
  • 3
    @zshh 😊
  • 4
    I have function called take that makes a directory and cd's into it but it's quite too long to type here
  • 3
    @epse
    function take {
    mkdir $1
    cd $1
    }

    // ???

    Those I suppose it should do error checking, too, and handle multiple directories. A loop with sed/awk would do.
  • 2
    @epse
    function mkdcd {
    mkdir $1
    cd $1
    }
  • 2
    I got a few functions myself

    #cleans up unused docker trash
    dockerclean(){
    docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
    docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
    }
    #retry command until it works, old command from dialup days but still being used
    retry(){
    $@
    if [ ! $? -eq 0 ]; then
    retry $@
    fi;
    }
    #spell check for php
    sc(){
    find . -iname \*.php -exec aspell --mode=html check '{}' \;
    }
    #per-directory env variables
    cd(){
    builtin cd "$@"
    [ -f './.env' ] && . .env
    }
    [ -f './.env' ] && . .env
  • 3
    alias clera='clear'
    alias ckear='clear'
    alias fur='git'

    Etc. You can imagine...
  • 4
    Your 'gforbm' is just 'the' for me. Also:

    alias g=git
    alias gst=git status (can't remember options)
    alias gd=git diff
    alias ga.=git add .
    alias gaa=git add --all
    alias gp=git push
  • 3
    @edensg it's a bit more tricky since there are a ton of edge cases but tbh I just stole it fro. T the interwebs
  • 1
    gs = git status
    gpp = git pull && git push
    gaa = git add .
    ga = git add
    gg = git commit
    pa = php artisan (for laravel)
    project = cd /var/www/html
    dir = ll

    Etc.
Add Comment