Terminal Tip: Aliases!

If you’re on a Unix-based system like Linux or Mac, aliases in the terminal make life so much easier. It’s like making your own custom commands for things you do often.

Here’s just a few of mine so you can get the hang of them. On Linux, assuming bash is your login shell, these will go in the .bashrc file in your home folder (files that start with “.” are invisible by default).

alias cs='conkystart'

This one just runs a custom script I wrote to (re)start Conky without a lot of fuss. The script kills all running Conky processes and then loads up all my config files in one go.

alias s='killall conky; sleep 2; xset dpms force off'

I used “s” for “sleep”, and I run this right before I go to bed. As you can see it runs multiple commands separated with a semi-colon. This one shuts off Conky and my monitors.

alias duck='find ~ -type f -ls | sort -k 7 -r -n | head -20'

This will search my entire home folder for the 20 largest files. Useful to find bloated log files, and all I have to type is “duck”!

alias n='xed ~/Documents/File.txt &'

Use aliases to open commonly-used files. Typing “n” will open my notes file instead of fishing around in the file manager for it.

alias ls='ls --color'

Use aliases for command substitution. Whenever I use the “ls” command I always want it to use the color option, and now it does.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *