alias bzip2='pbzip2'
alias bunzip2='pbzip2 -d'
alias gzip='pigz'
alias gunzip='pigz -d'
alias xz='pixz'
alias tar='tar --use-compress-program=pbzip2'
alias tar='tar --use-compress-program=pigz'Ask HN: Best things in your bash_profile/aliases?
121–130 of 288 posts
Re: Ask HN: Best things in your bash_profile/aliases?
#122 alias master='git checkout master'
alias f='git fetch --all'
alias s='git status --untracked-files=all'
# go to the last branch I worked on, excluding master and the current branch
alias lb='git checkout `git for-each-ref --sort=-committerdate refs/heads/ | grep -v refs/heads/master$ | grep -v \`git rev-parse --abbrev-ref HEAD\`| head -n1 | cut -d \/ -f 3-`'Re: Ask HN: Best things in your bash_profile/aliases?
#123Out of everything I like this little alias the most: cls="clear; ls" It harkens back to DOS. Clearing the screen followed by ls happens surprisingly often, if not just to start things in "clean slate". I'm quite fond of it.
Re: Ask HN: Best things in your bash_profile/aliases?
#124I use bash, but I like the zsh feature where you could type "cd -n" and go back n entires in your "directory stack", so I made my own version as a function. It's probably subtly broken in some way, since it's bash, but it works relatively well for me: cd() { # Set the current directory to the 0th history item cd_history[0]=$PWD if [[ $1 == -h ]]; then for i in ${!cd_history[@]}; do echo $i: "${cd_history[$i]}" done r…
cd() { if [[ -n "$2" && "$1" != "--" ]]; then builtin cd "${PWD/"$1"/"$2"}"; else builtin cd "$@"; fi; };
It's niche functionality, but super useful when you hit its niche: user@machine:/usr/src/linux-kbuild-4.9/scripts/mod$ cd 4.9 4.8
user@machine:/usr/src/linux-kbuild-4.8/scripts/mod$
I'll leave combining these two as an exercise for the reader.Re: Ask HN: Best things in your bash_profile/aliases?
#125Can I add something from .vimrc? If you put the commands: set undofile set undodir=~/.vim/undodir You get infinite undo in your files. Now when you go into a file, delete or add some text and close your terminal down, the next time you enter vim you can (re|un)do previous operations. Has saved my ass more times than I care to mention over my career!
Re: Ask HN: Best things in your bash_profile/aliases?
#126Not strictly an alias, but autojump has been a huge productivity booster for me. Installing it sets up an alias of `j` which guesses the best directory to cd to based on your cd history. So instead of having to type `cd ~/Projects/someproject` you could just type `j some` and it'll end up there. https://github.com/wting/autojump
+1. Very useful extension
Re: Ask HN: Best things in your bash_profile/aliases?
#127Not strictly an alias, but autojump has been a huge productivity booster for me. Installing it sets up an alias of `j` which guesses the best directory to cd to based on your cd history. So instead of having to type `cd ~/Projects/someproject` you could just type `j some` and it'll end up there. https://github.com/wting/autojump
Re: Ask HN: Best things in your bash_profile/aliases?
#128Speaking of, what's this vi thing people keep mentioning? :>
Re: Ask HN: Best things in your bash_profile/aliases?
#129 COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
See the Bash FAQ for more info.Re: Ask HN: Best things in your bash_profile/aliases?
#130alias lcoate=locate alias ll="ls -l" alias ..="cd .." alias ...="cd ../.." alias mdd='mkdir $(date -I)' alias cdd='cd $(date -I)' alias xt="xtermset -T " alias dtail="dmesg|tail"
alias cdl="cd (ls -ltr1 | grep '^d' | tail -1 | awk '{print $9}');"
cd to last directory by date.