Skip to content

Instantly share code, notes, and snippets.

@rvighne
Created July 28, 2017 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvighne/b6affd7ef5a231ed70e46a885360e248 to your computer and use it in GitHub Desktop.
Save rvighne/b6affd7ef5a231ed70e46a885360e248 to your computer and use it in GitHub Desktop.
Bash shortcuts that I always find useful. Source it from your .bashrc so it is always available (on Ubuntu, you can simply name it ~/.bash_aliases)
# When the given command terminated, run it again unless interrupted
retry() {
while :; do
"$@"
tput bold; tput setaf 1
echo "Retrying $1 (Ctrl-C to cancel)"
tput sgr0
sleep .5
done
}
# Create a directory, then change into it
mkcd() {
mkdir $1
cd $1
}
# Remove the current directory, and end up in the parent directory
rmcd() {
cd ..
rm -r $OLDPWD
}
# Shorter way to shutdown
off() {
sudo shutdown -h now
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment