News for hackers. Stuff that matters.

Ask HN: Share your favourite bash/zsh aliases

I'll start by adding the most essential.

alias o="open"

alias x="exit"

alias g="git"

alias gs='git status'

alias gd='git diff'

alias g-='git checkout -'

alias serve='python -m SimpleHTTPServer 8000'

alias mem='top -l1 | grep PhysMem'

( 73 comments | 38 points | on HN )
Re:Ask HN: Share your favourite bash/zsh aliases by ubertaco on Saturday July 11, 2015 @09:03AM (#9869613)
A function, not an alias, but I've found it useful when working on deeply-nested projects/dirs:

    function up {
        if [[ "$#" < 1 ]] ; then
            cd ..
        else
            CDSTR=""
            for i in {1..$1} ; do
                CDSTR="../$CDSTR"
            done
            cd $CDSTR
        fi
    }

I can just run "up" to "cd ..", or I can run "up 6" to "cd ../../../../../.."
Re:Ask HN: Share your favourite bash/zsh aliases by mariocesar on Saturday July 11, 2015 @09:00AM (#9869605)

  # Fast shortcuts
  alias c='clear'
  alias r='reset'
  alias q='exit'

  alias cd..="cd .." # I often make this mistake

  # Because sometimes you don't have the time to put this two letters
  alias ..='cd ..'
  alias ...='cd ../..'
  alias -- -="cd -"

  # Doing a fast proxy, good for watching netflix and youtube without restrictions
  alias proxy='ssh -C2qTnN -D 8080'

  # To search process with more details
  alias pp="ps axuf | pager"

  # Because I forget the name :(
  alias explore="ranger"

  # Because NeoVim is awesome :)
  alias vim=nvim

  # Do something and receive a desktop alert when it completes `sudo apt-get install something | alert`
  alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

  # Search process by name and highlight !
  function psgrep() { ps axuf | grep -v grep | grep "$@" -i --color=auto; }

  # Search for files and page it
  function search() { find . -iname "*$@*" | less; }
Re:Ask HN: Share your favourite bash/zsh aliases by guh_me on Saturday July 11, 2015 @01:56PM (#9870837)
You can enable AUTOCD and never have to type CD again. :)

shopt -s autocd

Re:Ask HN: Share your favourite bash/zsh aliases by nesQuick on Sunday July 12, 2015 @12:22PM (#9873920)
what would a OSX version of alert look like?
Re:Ask HN: Share your favourite bash/zsh aliases by pdkl95 on Saturday July 11, 2015 @06:33AM (#9869276)

    # eXpand anything
    alias xx="atool -x"   
( http://www.nongnu.org/atool/ )

The incredible amount of time this has saved over the years is great, but the real benefit never having remember either inspect archive files for the initial directory or remember to do this dance:

    % mkdir foo
    % cd foo
    % tar zxvf /path/to/bar.tar.gz  # or "unzip foo.zip" or "7x x foo.7z" etc
    % mv bar-1.2.3 ..
    % cd ..
    % rmdir foo
Re:Ask HN: Share your favourite bash/zsh aliases by Fannon on Saturday July 11, 2015 @08:21AM (#9869486)
I have found this bash function a while ago. It doesn't save all the steps, but it shouldn't be too difficult to add them, too.

https://gist.github.com/Fannon/41b0a6104435943cd826

Re:Ask HN: Share your favourite bash/zsh aliases by pdkl95 on Saturday July 11, 2015 @12:35PM (#9870410)
I used to use something similar, but atool is far superior. It handles quite a few situations, but the most important is that it will decompress into the current directory (as a normal "tar zxvf foo.tar.gz" or "unzip foo.zip") if-and-only-if there was exactly one file or directory at the top level of the in the archive. If the archive was packaged badly, it will leave the resulting files in the temporary directory it creates. Also, atool leave the file(s) in the temporary directory in the event of a name collision, so you protected from the risk of clobbering existing files.

Without atool you have to either 1) create a temporary dir youself and do the dance I showed above, or 2) always inspect every archive before you decompress it to see if it has multiple top-level files, or 3) accept that typing "tar xvf" or similar will sometimes spam your current directory (often $HOME) with thousands of files.

Similar to how git tends to remove mental blocks around branching (you not longer have ot worry about the cost of making an arbitrary change), atool frees you from having to worry about how an archive was created. This has, in practice, saved huge amount of time and mental effort.

Re:Ask HN: Share your favourite bash/zsh aliases by frnx on Saturday July 11, 2015 @08:42AM (#9869540)
Here are a few I haven't seen in a lot of places but come in really handy.

First, alias this on Linux to get the 'open' command to work like OSX (e.g. 'open file.pdf'). It shadows a real 'open' command, but I have never used it, so no big loss :

  alias open='xdg-open'
The second one I use all the time. A process that is stuck on I/O (or other uninterruptible syscalls), or even a Python interpreter stuck in a C extension, won't always respond well to Ctrl-C. However, Ctrl-Z (suspend) and this alias (kills the last suspended process group) do work relatively well :

  alias killit='kill -9 %%'
This one I use a lot for copying the output of a command to the clipboard. Just run 'command | pbcopy' and then Ctrl-V elsewhere. pbcopy is actually an OSX command, I aliased it on Linux for ease of use :

  alias pbcopy='xclip -selection clipboard'
  alias pbpaste='xclip -selection clipboard -o'
This one runs a program under GDB. You can run e.g. 'gdbrun =python test.py' and debug C extensions more easily:

  alias gdbrun='gdb -ex=r --args'
Re:Ask HN: Share your favourite bash/zsh aliases by jcr on Saturday July 11, 2015 @07:56AM (#9869433)
The essential and usual one handed listing aliases:

  alias l='ls -laFT'
  alias ll='ls -1aF'
  alias k='ls -laFTrt'
  alias kk='ls -1aFrt'
Some X + tee magic for logging.

  alias xlog='mv .xlog.txt .xlog.txt.old && startx -- -nolisten tcp 2>&1 | tee . xlog.txt > /dev/console'

  alias xdbg='mv .xdbg.txt .xdbg.txt.old && startx -- /usr/X11R6/bin/X -keepPriv 2>&1 | tee .xdbg.txt > /dev/console'
And in ~/.xinitrc run an oddly colored xterm with /dev/console output:

  xterm -C -fg '#b00020' -geometry 80x38+0+0 &
Most folks don't start X manually but when working on X itself, extra logging can often help.
Re:Ask HN: Share your favourite bash/zsh aliases by binaryghost on Saturday July 11, 2015 @09:34AM (#9869706)
#make intermediate directories and touch a file all at once

#e.g. mktouch ~/Desktop/test/file.md would make the test dir if it didn't exist then touch file.md inside of it

mktouch() {

    if [ $# -lt 1 ]; then
        echo "Missing argument";
        return 1;
    fi

    for f in "$@"; do
        mkdir -p -- "$(dirname -- "$f")"
        touch -- "$f"
    done
}
Re:Ask HN: Share your favourite bash/zsh aliases by danwakefield on Saturday July 11, 2015 @08:42AM (#9869543)
I use most of the oh-my-zsh builtins. The git ones save a ton of time and G='|grep' is brilliant.

    alias GD='git diff HEAD~1 HEAD'
    alias grv='git review'
    alias gunmod='git status | grep "modified" | awk "{print \$2}" | xargs -I{} git checkout -- {}'
    alias gv='gvim --remote-silent'
    alias json='| python -m json.tool'
    alias vg='vagrant'
    alias ans='ansible '
    alias ansp='ansible-playbook '
    alias vv='virtualenv venv'
    alias vvp='venv/bin/python'
    alias vvpi='venv/bin/python setup.py develop'
    alias yt='cd $HOME/downloads; youtube-dl --verbose'
    alias yt3='cd $HOME/downloads; youtube-dl --verbose --extract-audio --audio-format mp3 '
I keep all of my shell history, right now it think it goes back ~3 years, so every now and then I filter it by frequency and check if I am using a command often enough to justify an alias. Works quite well
Re:Ask HN: Share your favourite bash/zsh aliases by egwynn on Saturday July 11, 2015 @08:52AM (#9869572)

  > alias json='| python -m json.tool'
Is the beginning pipe intended? If I just run 'python -m json.tool' then it starts reading from stdin by itself (and works as intended). And with the pipe, I can’t seem to make the alias work.

  $ echo  '{ "foo": 1234}' | json
  -bash: syntax error near unexpected token `|'

  $ json
  -bash: syntax error near unexpected token `|'
Re:Ask HN: Share your favourite bash/zsh aliases by danwakefield on Saturday July 11, 2015 @09:02AM (#9869609)
yeah, thats my bad, A recent addition and I must have copied too much of the command line when adding it.
Re:Ask HN: Share your favourite bash/zsh aliases by halisaurus on Saturday July 11, 2015 @08:44AM (#9869548)
Assuming functions count:

    # git branch ahead/behind another
    function gahead() {
      # use first argument or master
      original=${1-master}

      # use the second argument or current branch if not given
      current=`git branch | grep \* | sed s/\*\ //`
      compare=${2-$current}

      # run git rev-list and capture numbers returned
      result=`git rev-list --left-right --count $original...$compare`

      # print numbers in a pretty message
      numbers=($result);
      echo -e "$Red-$Color_Off $compare is currently $IRed${numbers[0]}$Color_Off commits behind $original";
      echo -e "$Green+$Color_Off $compare is currently $IGreen${numbers[1]}$Color_Off commits ahead of $original";
    }
Edit: if it's not clear you would use this like:

    $ gahead #checks current branch against master
    $ gahead development #checks current branch against development
    $ gahead development foo #checks foo branch against development
NB: this is checking local branches, not remote branches.
Re:Ask HN: Share your favourite bash/zsh aliases by ajdlinux on Saturday July 11, 2015 @10:15AM (#9869835)
Starting a (generally GUI) application in the background and detaching it as much as possible from the current terminal, so it doesn't quit on a SIGHUP. I have this as a bash script (~/bin/bgrun), but it could pretty easily become an alias or function:

    #!/bin/bash
    nohup "$@" > /dev/null 2>&1 < /dev/null &
Re:Ask HN: Share your favourite bash/zsh aliases by anotherevan on Saturday July 11, 2015 @09:40PM (#9872286)
I have the same script, calling it nnohup in my ~/bin folder.

Common GUI programs I often launch from the command line I put an alias in my .bashrc for. e.g.

  alias thg="~/bin/nnohup /usr/bin/thg"
  alias rabbitvcs="~/bin/nnohup /usr/bin/rabbitvcs"
  alias meld="~/bin/nnohup /usr/bin/meld"
  alias xnview="~/bin/nnohup /usr/bin/xnview"
  alias dolphin="~/bin/nnohup /usr/bin/dolphin"
  alias vlc="~/bin/nnohup /usr/bin/vlc"
Re:Ask HN: Share your favourite bash/zsh aliases by 1hackaday on Saturday July 11, 2015 @08:19AM (#9869482)

  alias ..='cd ..'
  alias ...='cd ../..'
  alias ....='cd ../../..'
  alias .....='cd ../../../..'
  alias ......='cd ../../../../..'
   
  # search history (??) and processes (???)
  alias '?=fc -li 1'
  alias '??=fc -li 1 | grep '
  alias '???=ps-grep'
   
  alias m='less'
   
  alias su='sudo -H -s'
   
  # move to trash rather than deleting
  rm='trash-put -v'
   
  # simplify hard to remember command names
  alias pk-show='apt-cache show'
  alias pk-install='sudo apt-get install'
  alias pk-update='sudo apt-get update'
  alias pk-update-upgrade='sudo apt-get update && sudo apt-get upgrade'
  alias pk-uu=pk-update-upgrade
  alias pk-remove='sudo apt-get remove'
  alias pk-debinst='sudo dpkg -i'
  pk-search () {
    apt-cache search $1 | sort | egrep "${1}|$"
  }
Re:Ask HN: Share your favourite bash/zsh aliases by groks on Saturday July 11, 2015 @10:58AM (#9869971)
(Use ^d instead of aliasing x to exit)

Use magit in emacs as a git front-end instead of dozens of git aliases. You can continue to use vi or eclipse or whatever for editing. Use dired in emacs to replace a lot of file manipulation aliases.

Replace all your complicated aliases with ^r reverse search. For example, instead of typing

    sudo dnf --refresh check-update
I type

    ^rche
because 'check' is the most distinct string in that command in my mind, and by 'che' bash has already located the last time I typed it in the history. Save lots of history:

    HISTSIZE=100000                   # Lots of history.
    HISTFILESIZE=100000               # Lots of history in the file.
    HISTCONTROL=ignoreboth            # Ignore entries with leading white space and dupes.
    HISTIGNORE="ls:ll:cd:fg:j:jobs"   # Uninteresting commands to not record in history.
    shopt -s histappend               # Append history to file, don't overwrite.
    shopt -s histverify               # Show expanded history before running it.
    shopt -s cmdhist                  # Store multiline cmds as single
Which directory is hiding all the bytes?

    alias dux='du -x --max-depth=1 | sort -n'
Machines on the local network:

    alias nwho='ping -b -c 2 255.255.255.255 2>&1 | grep "bytes from" | cut -d " " -f 4 | sort | uniq | sed -e "s/://g"'
Set the permissions to allow sharing of files in a directory between users in the same group (probably doesn't work on bsd/osx):

    function rwxs {
        find $1 -type d | xargs chmod u+rwx,g+rwxs,o+rx
        find $1 -type f | xargs chmod ug+rw,o+r
    }
Re:Ask HN: Share your favourite bash/zsh aliases by jetpm on Saturday July 11, 2015 @09:01AM (#9869607)
I made a bash function for easier alias binding. It makes aliases immediately available and permanent. Also you don't need quotes so you can use tab completion etc. It goes like this:

ali <name of alias> <command>

to get it put this in your .bashrc

  function ali() {  
   echo "alias $1='${@:2}'" >> ~/.bashrc   #in ubuntu use   ~/.bash_aliases  
   echo "made alias:";  
   echo "alias $1='${@:2}'";  
   source ~/.bashrc;  #reload bashrc  
  }

When I realize I type a command often, I just push the up arrow to get the command again, append "ali" infront of it and turn it to an alias. Works direclty.

And of course the alias to show the list of all aliases:

  alias alis='cat ~/.bash_aliases'
Re:Ask HN: Share your favourite bash/zsh aliases by a3n on Saturday July 11, 2015 @01:09PM (#9870589)
> alias alis='cat ~/.bash_aliases'

That only lists what's in .bash_aliases, along with any comments.

Why not just run alias without arguments? It lists all active aliases, however and whenever they were defined.

  $ man bash
  /^SHELL BUILTIN COMMANDS
  ...
  alias [-p] [name[=value] ...]
"Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output."
Re:Ask HN: Share your favourite bash/zsh aliases by rey12rey on Saturday July 11, 2015 @10:57AM (#9869964)
I use a lot of oh-my-zsh's git aliases and a couple others but here are the ones I've used the most over time and some

alias _=sudo

alias aria='aria2c --file-allocation=none -c -x 10'

alias aria_list='aria2c --file-allocation=none --force-sequential=true -c -x 10 -i'

alias d='dirs -v | head -10'

alias hdmi='xrandr --output HDMI1 --auto --right-of LVDS1'

alias history='fc -l 1'

alias la='ls -lAh'

alias lock='i3lock -c #1E90FF'

alias ls='ls --color=tty'

alias md='mkdir -p'

alias pyfind='find . -name ".py"'

alias pygrep='grep --include=".py"'

alias rd=rmdir

alias reload_sound='pulseaudio -k && sudo alsa force-reload' # when sound messes up

alias settings=gnome-control-center

alias sl=ls

alias utorrent='utserver -settingspath /opt/utorrent-server-alpha-v3_3/ &'

alias vga='xrandr --output VGA1 --auto --right-of LVDS1'

alias vga_same='xrandr --output VGA1 --auto --same-as LVDS1'

Re:Ask HN: Share your favourite bash/zsh aliases by zimmund on Saturday July 11, 2015 @09:04AM (#9869614)
Simple Vagrant aliases:

  alias vup='vagrant up'
  alias vdn='vagrant halt'
  alias sv='ssh vagrant'
Some apt-get ones:

  alias sapu='sudo apt-get update'
  alias sapi='sudo apt-get install'
  alias sapr='sudo apt-get remove'
When I'm in Windows I use Cygwin (as a dropdown terminal[1]), these are useful:

  alias tk='taskkill -f -im'
  alias ping='PING'
  alias flush='ipconfig /flushdns'

[1]: http://blog.elamperti.com/2014/11/dropdown-cygwin-terminal-i...
Re:Ask HN: Share your favourite bash/zsh aliases by nathan_f77 on Saturday July 11, 2015 @08:18AM (#9869479)
Check out SCM Breeze [1] if you are interested in git aliases.

[1]: https://github.com/ndbroadbent/scm_breeze

Re:Ask HN: Share your favourite bash/zsh aliases by egwynn on Saturday July 11, 2015 @08:38AM (#9869529)

  alias sucs='sort | uniq -c | sort -n’ # Makes a histogram of line-based input
  
  # Example
  $ echo c c c c b c b a a a | xargs -n1 | sucs
   2 b
   3 a
   5 c
Re:Ask HN: Share your favourite bash/zsh aliases by anotherevan on Saturday July 11, 2015 @09:43PM (#9872292)
Quick mv -i and cp -i aliases:

  alias mvi="mv -i"
  alias cpi="cp -i"
Truncate a file to empty:

  alias zeroout="truncate -s 0"
Re:Ask HN: Share your favourite bash/zsh aliases by nemild on Saturday July 11, 2015 @08:43AM (#9869546)
Have you taken a look at the top dotfiles on Github ( https://dotfiles.github.io/ )? They have a pretty good set of aliases, especially the basics and many for git.

For example, YADR is pretty good ( https://github.com/skwp/dotfiles ).

Of the ones not listed already in this thread, a few standards that are great to have:

L - less

H - | head

T - | tail

G - | grep

C - | wc -l

N - /dev/null

S - | sort

_ - sudo

Re:Ask HN: Share your favourite bash/zsh aliases by erikb on Saturday July 11, 2015 @08:58AM (#9869595)
the dotfiles site seems a good idea but for some reason I'm basically unable to read the text. Even highlighting some with the mouse doesn't help.
Re:Ask HN: Share your favourite bash/zsh aliases by orkj on Saturday July 11, 2015 @11:24AM (#9870092)
This is my favorite because it is so pleasing:

alias ffs=sudo

example usage:

  $ grep 'something' some.conf
  grep: some.conf: Permission denied
  $ ffs !!
  Password:`
Re:Ask HN: Share your favourite bash/zsh aliases by laxk on Monday July 13, 2015 @04:16AM (#9876950)
I'm using please alias. You don't need even use !!. alias pls='sudo `fc -n -l -1`'
Re:Ask HN: Share your favourite bash/zsh aliases by nness on Saturday July 11, 2015 @08:42AM (#9869541)
If you're a virtualenv user, I use this one-liner to start load a virtualenv named after the current directory:

    alias v='workon "${PWD##*/}"'
Also, I really like the -p flag of mkdir (creating child directories as needed, without failing if one doesn't exist)

    alias mkdir='mkdir -p'
    # i.e. mkdir ./a/b/c/
Re:Ask HN: Share your favourite bash/zsh aliases by 0942v8653 on Saturday July 11, 2015 @08:47AM (#9869560)
I don't have many. Tab completion on linux is usually enough.

    alias i='i3-msg -q exec --'
    alias jql='jq . -C | less -R'
Also bindings:

    bind -m vi-command -x '"\C-n": new-term-here'
    bind -m vi-insert  -x '"\C-n": new-term-here'

    #which is `i gnome-terminal --working-directory="$PWD"`
Re:Ask HN: Share your favourite bash/zsh aliases by poltak on Saturday July 11, 2015 @08:53AM (#9869575)
My most used aliases would probably have to be for the git commands. Each git command, I have aliased to the name of the command, preceded with the letter 'g'. So:

  alias gadd='git add'
and so on.

I find the oh-my-zsh git plugin's default aliases to be unintuitive and hard to remember. Simply not having to type 'git ' before everything is good enough for me.

Re:Ask HN: Share your favourite bash/zsh aliases by namecast on Saturday July 11, 2015 @09:10AM (#9869632)

    alias c='noglob perl -e '\''shift; $x = eval qq(@ARGV); print $x; printf " 0x%x 0%o %b\n", $x, $x, $x'\'' _' ' "'
Quick and easy perl calculator, with octal, decimal and hex output. Example usage:

    root:~$ c 365 * 24 * 6 / (14 +2)
    3285 0xcd5 06325 110011010101
Re:Ask HN: Share your favourite bash/zsh aliases by kenrose on Saturday July 11, 2015 @08:44AM (#9869549)
On Mac OS, copy the CWD to the clipboard:

alias cpcd="echo -ne \$(pwd) | pbcopy"

Useful when you have a file picker in front of you, but you know you have a terminal already in the directory you want. Switch to the term, cpcd, switch to the file picker, Go to folder (⌘-Shift-G), Paste (⌘-V).

when you have a terminal open in a directory, but another app has a file picker box.

Re:Ask HN: Share your favourite bash/zsh aliases by nemild on Saturday July 11, 2015 @08:46AM (#9869553)
Why not just do 'open .' in Terminal/iTerm 2?
Re:Ask HN: Share your favourite bash/zsh aliases by DeBraid on Saturday July 11, 2015 @09:23AM (#9869667)
Pretty git log:

    alias gl="git log -n 15 --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
Copy current working dir (OSX), very handy.

    alias cpwd='pwd | pbcopy'
Re:Ask HN: Share your favourite bash/zsh aliases by uberspot on Tuesday July 14, 2015 @10:32AM (#9885137)
I love some of the aliases here. :D Added them to my toolbelt. Here are mine.

https://github.com/uberspot/dotfiles/blob/master/.alias

Re:Ask HN: Share your favourite bash/zsh aliases by andreastt on Saturday July 11, 2015 @08:38AM (#9869531)
Re:Ask HN: Share your favourite bash/zsh aliases by groks on Saturday July 11, 2015 @10:35AM (#9869891)

    sudo dnf install sl
Re:Ask HN: Share your favourite bash/zsh aliases by arh68 on Saturday July 11, 2015 @12:19PM (#9870336)

  l() { tree -L 1 -CDFha --du --dirsfirst $@; }
  ll() { l -L 2 $@; }
  lll() { l -L 3 $@; }
  md() { open -F -a /Applications/Marked\ 2.app/ $@; }
  st() { open -F -a /Applications/Sublime\ Text\ 2.app/ $@; }
Re:Ask HN: Share your favourite bash/zsh aliases by myhf on Saturday July 11, 2015 @09:14AM (#9869644)

    # quick sketching
    alias ep='emacs -eval "(picture-mode)"'
    
    # quick timer
    alias timer="time read -sn1"
    
    # quick look
    alias ql='qlmanage -p 2>/dev/null'
Re:Ask HN: Share your favourite bash/zsh aliases by noselasd on Saturday July 11, 2015 @08:45AM (#9869551)

    alias lc="ls -C | less"

    alias ll="ls -lh"

    function mkd() {
        if [[ $#  == 0 ]] ; then
            return
        fi

        mkdir "$1"
        cd "$1"
    }
Re:Ask HN: Share your favourite bash/zsh aliases by reinhardt on Saturday July 11, 2015 @09:36AM (#9869712)
# trim off trailing spaces

    alias rstrip='sed -i "s/[ \t]*$//"'
# delete .pyc files

   alias delpyc='find . -type f -name "*.pyc" -delete'
Re:Ask HN: Share your favourite bash/zsh aliases by betacar on Sunday July 12, 2015 @02:34PM (#9874394)

  alias ga="git add ."

  alias gs="git stash"

  alias gas="ga && gs"

  alias gmm="git merge master"

  alias grm="git rebase master"
Re:Ask HN: Share your favourite bash/zsh aliases by arxpoetica on Saturday July 11, 2015 @09:07AM (#9869622)
Quickly get my ip:

    alias myip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\   -f2"
Re:Ask HN: Share your favourite bash/zsh aliases by colindean on Saturday July 11, 2015 @09:26AM (#9869679)
I frequently have my machines connected via multiple interfaces. I put together a little simple C program that can be run as a script.

https://github.com/colindean/getip

I've not actually used it as a script in a while, and it appears to be broken in that regard at the moment (something about ld not being able to write to the tmp directory). However, its Makefile is still operational. Maybe someone will see this and submit a PR that fixes it?

Re:Ask HN: Share your favourite bash/zsh aliases by namtrac on Saturday July 11, 2015 @08:39AM (#9869536)
alias scp='rsync --archive --compress-level=3 --copy-links --partial --inplace --progress --rsh=ssh -r'
Re:Ask HN: Share your favourite bash/zsh aliases by halisaurus on Saturday July 11, 2015 @08:48AM (#9869564)
But now you can't use scp, right? Or did you alias that too?
Re:Ask HN: Share your favourite bash/zsh aliases by runejuhl on Saturday July 11, 2015 @09:00AM (#9869606)
Just prepend the command with `\`, that disables aliases.
Re:Ask HN: Share your favourite bash/zsh aliases by namtrac on Saturday July 11, 2015 @09:34AM (#9869703)
Well in zsh running =scp would run /usr/bin/scp not the alias.
Re:Ask HN: Share your favourite bash/zsh aliases by notinventedhear on Sunday July 12, 2015 @04:36PM (#9874868)
My best time-savers:

alias ff="find . -iname"

alias size="du -h --max-depth=1"

alias latest="ls -lt |head"

alias orly='sudo $(history -p \!\!)'

Re:Ask HN: Share your favourite bash/zsh aliases by edoceo on Saturday July 11, 2015 @02:21PM (#9870950)
Use .ssh/config to shorten all hostnames a set specific key combinations.

    ssh h.e.c
Re:Ask HN: Share your favourite bash/zsh aliases by a3n on Saturday July 11, 2015 @06:16AM (#9869251)

  alias l='ls -1F'
Re:Ask HN: Share your favourite bash/zsh aliases by olalonde on Saturday July 11, 2015 @08:30AM (#9869510)

  alias dc=docker-compose
Re:Ask HN: Share your favourite bash/zsh aliases by Fannon on Saturday July 11, 2015 @08:17AM (#9869475)
alias ip="curl icanhazip.com" # Your public IP address

alias diskspace="du -S | sort -n -r |less"

alias pyserver='python -m SimpleHTTPServer'

alias phpserver='php -S localhost:8000'

alias phplog='tail -f /var/log/apache2/error.log'

Re:Ask HN: Share your favourite bash/zsh aliases by d99kris on Saturday July 11, 2015 @09:31AM (#9869693)

  alias hn='elinks http://news.ycombinator.com/news'
Re:Ask HN: Share your favourite bash/zsh aliases by veddox on Saturday July 11, 2015 @04:31PM (#9871439)
alias todo='grep "FIXME" * ; grep "TODO" * ; grep "XXX" *'

Shows up all the things I still need to work on in a given project (assuming of course that you annotate your code...).

Re:Ask HN: Share your favourite bash/zsh aliases by lukasm on Saturday July 11, 2015 @08:07AM (#9869454)
I use oh-my-zsh aliases

    ...=../..
	....=../../..
	.....=../../../..
	......=../../../../..
	1='cd -'
	2='cd -2'
	3='cd -3'
	4='cd -4'
	5='cd -5'
	6='cd -6'
	7='cd -7'
	8='cd -8'
	9='cd -9'
	_=sudo
	afind='ack-grep -il'
	d='dirs -v | head -10'
	g=git
	ga='git add'
	gaa='git add --all'
	gap='git add --patch'
	gb='git branch'
	gba='git branch -a'
	gbr='git branch --remote'
	gc='git commit -v'
	'gc!'='git commit -v --amend'
	gca='git commit -v -a'
	'gca!'='git commit -v -a --amend'
	gcl='git config --list'
	gclean='git reset --hard && git clean -dfx'
	gcm='git checkout master'
	gcmsg='git commit -m'
	gco='git checkout'
	gcount='git shortlog -sn'
	gcp='git cherry-pick'
	gcs='git commit -S'
	gd='git diff'
	gdc='git diff --cached'
	gdt='git difftool'
	gg='git gui citool'
	gga='git gui citool --amend'
	ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
	ggpull='git pull origin $(current_branch)'
	ggpur='git pull --rebase origin $(current_branch)'
	ggpush='git push origin $(current_branch)'
	gignore='git update-index --assume-unchanged'
	gignored='git ls-files -v | grep "^[[:lower:]]"'
	git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
	gk='gitk --all --branches'
	gl='git pull'
	glg='git log --stat --max-count=10'
	glgg='git log --graph --max-count=10'
	glgga='git log --graph --decorate --all'
	glo='git log --oneline --decorate --color'
	globurl='noglob urlglobber '
	glog='git log --oneline --decorate --color --graph'
	glp=_git_log_prettily
	gm='git merge'
	gmt='git mergetool --no-prompt'
	gp='git push'
	gpoat='git push origin --all && git push origin --tags'
	gr='git remote'
	grba='git rebase --abort'
	grbc='git rebase --continue'
	grbi='git rebase -i'
	grep='grep  --color=auto --exclude-dir={.bzr,.cvs,.git,.hg,.svn}'
	grh='git reset HEAD'
	grhh='git reset HEAD --hard'
	grmv='git remote rename'
	grrm='git remote remove'
	grset='git remote set-url'
	grt='cd $(git rev-parse --show-toplevel || echo ".")'
	grup='git remote update'
	grv='git remote -v'
	gsd='git svn dcommit'
	gsps='git show --pretty=short --show-signature'
	gsr='git svn rebase'
	gss='git status -s'
	gst='git status'
	gsta='git stash'
	gstd='git stash drop'
	gstp='git stash pop'
	gsts='git stash show --text'
	gts='git tag -s'
	gunignore='git update-index --no-assume-unchanged'
	gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
	gup='git pull --rebase'
	gvt='git verify-tag'
	gwc='git whatchanged -p --abbrev-commit --pretty=medium'
	gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"'
	history='fc -l 1'
	l='ls -lah'
	la='ls -lAh'
	ll='ls -lh'
	ls='ls -G'
	lsa='ls -lah'
	md='mkdir -p'
	please=sudo
	po=popd
	pu=pushd
	rd=rmdir
	run-help=man
	which-command=whence
Re:Ask HN: Share your favourite bash/zsh aliases by gluelogic on Saturday July 11, 2015 @08:37AM (#9869527)
I laughed at "please=sudo". Never knew about that one.
Re:Ask HN: Share your favourite bash/zsh aliases by CJefferson on Saturday July 11, 2015 @08:17AM (#9869473)
Do these really save that much time?

I stopped using oh-my-zsh because of these. There is a popular program called 'gap' which got over-written by one of these aliases.

Re:Ask HN: Share your favourite bash/zsh aliases by gluelogic on Saturday July 11, 2015 @08:34AM (#9869518)
I am hooked on most of them at this point, but I can see that being very annoying.
Re:Ask HN: Share your favourite bash/zsh aliases by lukasm on Saturday July 11, 2015 @09:24AM (#9869671)
yes they do. I also learnt a bit about git from them glg and git whatchanged ale quite useful.

One problem I had with gulp. I had dir name gulp and zsh got confused weather to go to the dir or execute the cmd.

Re:Ask HN: Share your favourite bash/zsh aliases by a_bonobo on Saturday July 11, 2015 @08:35AM (#9869523)
alias cp='cp -i'

prompts when you overwrite something using cp ("oops, wrong folder")

alias rm='rm -I'

prompts when you delete more than three files ("oops, a space too much in rm ./ *")

Re:Ask HN: Share your favourite bash/zsh aliases by calyhre on Saturday July 11, 2015 @09:27AM (#9869682)

  alias nope="git commit -m 'ಠ_ಠ'"
Re:Ask HN: Share your favourite bash/zsh aliases by sebastianmarkow on Saturday July 11, 2015 @09:49AM (#9869754)
Re:Ask HN: Share your favourite bash/zsh aliases by yanis_t on Sunday July 12, 2015 @05:29AM (#9873004)
Create and cd into mkcd() { mkdir $@ && cd $_ }
Re:Ask HN: Share your favourite bash/zsh aliases by tarrsalah on Saturday July 11, 2015 @02:15PM (#9870925)
My favorite one is: alias fuck='pkill -9'
Re:Ask HN: Share your favourite bash/zsh aliases by fourier on Sunday July 12, 2015 @06:39AM (#9873083)
alias e='emacsclient'

alias serv="ssh [email protected]"

alias work="cd /Users/myname/Sources/mycompany/myproject"

Re:Ask HN: Share your favourite bash/zsh aliases by giuscri on Saturday July 11, 2015 @09:09AM (#9869629)
alias ":q"="exit"
Re:Ask HN: Share your favourite bash/zsh aliases by namuol on Saturday July 11, 2015 @08:54AM (#9869583)

    alias ..='cd ..'
Re:Ask HN: Share your favourite bash/zsh aliases by atsaloli on Sunday July 12, 2015 @01:09AM (#9872632)
alias s=ssh
Re:Ask HN: Share your favourite bash/zsh aliases by vtempest on Sunday July 12, 2015 @08:59PM (#9875765)
Install useful .bashrc shortcuts: u check updates, l detailed file list, .. parent dir, i [appname] install package, x [file] uncompress file, own [dir] get access to folder, p [procname] find process by name, f [string] find string in this folder's files, gg git commit and push

sed -i "$ a\#custom shortcuts \nx(){ case \$1 in .tar.bz2) tar xjf \$1;; .tar.gz) tar xzf \$1;; .bz2) bunzip2 \$1;; .rar) rar x \$1;; .gz) gunzip \$1;; .tar) tar xf \$1;; .tbz2) tar xjf \$1;; .tgz) tar xzf \$1;; .zip) unzip \$1;; .Z) uncompress \$1;; esac; } \nf(){ grep -R -I \"\$1\" ./*; } \np(){ ps aux | grep \$1 | grep -v grep; } \nown(){ sudo chmod 777 -R \${1:-.} && sudo chown -R \${USER} \${1:-.}; } \nalias u='sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y' \nalias l='ls -la' \nalias ..='cd ..' \nalias i='sudo apt-get install -y ' \nalias gg='git add . && git commit -a -m "." && git push -u -f origin master'" ~/.bashrc && source ~/.bashrc

More here https://github.com/gulakov/nodejs-starter/blob/master/README...

Re:Ask HN: Share your favourite bash/zsh aliases by fortytw2 on Saturday July 11, 2015 @08:57AM (#9869594)
has always served me well - `alias yolo='git rm -f * && git commit -am "yolo" && git push -f origin master'`