From bash to zsh and everywhere in between, show me yours and I’ll show you mines. Inspire others or get some feedback.
Simply copy & paste the output of alias in your terminal or add some comments to explain things for others.
Edit: Kbin users, click ‘More’ on a comment and use the fediverse link to read responses that have funky formatting
I rawdog every single command, I use no aliases at all.
I couldn’t even work if I had aliases in my muscle memory. Imagine ssh’ing to a server and every second command you issue doesn’t exist because it’s some weird alias you set up for yourself.
I’ll stick with the “pure” command and use tab completion.
That’s also part of the reason why I don’t use some of the fancy new tools like ripgrep and exa.
Yeah, I remember when Linux was first becoming cool, in the mid-to-late 90s. There was a lot of folk wisdom going around, and one of them was “make an
alias rm='rm -i'
so you don’t accidentally delete anything!”And then there was the (correct, IMHO) counter-wisdom of “no, that actually makes it more likely to accidentally delete something, because one day you’re going to be on a machine where that alias doesn’t exist, but you’ve become dependent on it existing”.
I don’t mind creating aliases to add colour or change formatting a little bit or something, but don’t make an alias to keep yourself safe, because it’ll probably backfire on you.
A different way to do the usual
..="cd .."
and endless chains of...="cd ../.."
types of aliases:bash
/ksh
version:..() { local count="${1:-1}" local path="../" while (( --count > 0 )); do path="$path../" done cd -- "$path" }
zsh
single-line version:..() { cd $(printf "../%.s" {1..${1:-1}}) }
These take the number of directories that you want to move up as an argument (e.g.
.. 3
), otherwise they move you up one directory when used with no arguments.