• Rob's side project: I recently started Gun-Forums.com and we currently have a $100 raffle - if you're into guns, join up and enter the raffle to win $100.00. Gun Forums

What are your favourite aliases?


Well-Known Member
The idea of this thread is to post your favourite aliases from your .bashrc.

Section 1 - What is an alias?
If you already know what an alias is, feel free to skip this section and check out section 2 containing my aliases, or just go ahead and post some of your favourite aliases.

But if you don't know what aliases are, I will explain. Please read on.....

Aliases allow you to create convenient shortcuts for common commands - to save you some typing, and/or to prevent you having to remember a lot of different commands/switches etc.

So if there are any really long commands that you use often. Instead of having to type the whole command, you can open up your .bashrc file and set up an alias instead. Or if it is just something you will be using in the current terminal session, you can just set up a temporary alias using the built-in alias command.

Whether you set a temporary alias for the current terminal session, or set a permanent one in your .bashrc file. The syntax to set up an alias is:
alias alias_name='/your/commands/and -options -go -here'
As a practical example:
is a command that everybody uses in the terminal and there are lots of different options/switches that can be passed to ls that will allow you to see files listed in different ways. If you always want the output to appear in a certain way, you can set your preferences by setting up an alias for ls.

So if you always want ls to show all files, in the long-list format, with indicators at the end of file-names ( e.g. / for directories, * for executables), with human-readable file-sizes and you always want to see directories listed first; Then you could set the following alias:
alias ls='ls -alFh --group-directories-first'
Now whenever you type ls, the alias will be invoked and you will see the output in your desired format.
To invoke the original ls without using your alias, you can bypass the alias by typing:
That will ignore any aliases for ls and will directly run the ls command in /usr/bin/ instead.

Alternatively, if an alias is no longer required you can use the unalias command to remove it from the current terminal session, or you could remove it from your .bashrc file if it is a permanent one.
The syntax for the unalias command is:
unalias name_of_alias_to_remove

Section 2 - My favourite aliases:
OK, now you know what aliases are - here are a few of my favourites:

Re-read/Re-apply .bashrc
This is something I use a lot. Whenever I make changes to my .bashrc, I often want to apply them to any terminals I have open. So I have set-up the following alias:
alias reinit='. ~/.bashrc'
After making changes to my .bashrc, I can use the reinit alias to quickly apply the changes to the current terminal.

Remove backup files
As a vim user, I find that I often end up accumulating a lot of backup files. So I have set up a couple of aliases which I periodically use to remove unwanted backup files.
alias rmb='find ./ -type f -iname "*~" -delete &'
alias rmib='find ./ -type f -iname "*~" -exec rm -i {} \;'
rmb will recursively find and delete all files with names that end with the ~ character. Because of the & at the end of the command, find is ran in the background. That way I can continue working in the terminal while the find command finds and removes backup files.

rmib will recursively find all files with names that end with the ~ character and will interactively ask whether to remove each file it finds. Because this is an interactive command, I don't run it in the background.

Listen to internet radio-stations in the terminal
From looking at my avatar-pic, or reading my profile here you've probably guessed that I'm quite heavily into music.... And heavy music at that.

When working in the terminal I like to be able to listen to a bit of music. And I don't always want to interrupt my flow by firing up a GUI media player. So I've set up aliases for two of my favourite internet radio stations - Hard Rock Hell Radio and Neue Regel Radio:
alias HRH='cvlc http://andromeda.shoutca.st:9254 &> /dev/null &'
alias NRR='cvlc &> /dev/null &'
With these aliases in place, I can listen to my favourite stations by issuing the HRH or NRR command in the terminal.

On execution of one of these aliases:
cvlc is started in the background and starts streaming the station I want to listen to.

All text output (error messages etc) is redirected to /dev/null using the &> redirection operator - so the running process never interrupts what I am doing.

When I'm finished listening, I use the jobs command to get the PID for vlc:
jobs -l
And then I use the kill command to kill it:
kill -15 {PID}
Note: the use of signal 15 (SIGTERM), which politely asks the process to end, rather than signal 9 (SIGKILL) - which will forcefully kill the process. See here for more info...

At some point, I'll probably get around to setting up an alias for that too! :)

Anywhoo, those are a few of my favourite aliases. What are yours?
Last edited:


Well-Known Member
Since making my original post about aliases, I've solved my command-line media player woes.

Instead of firing off cvlc in my audio-related aliases (and then having to manually kill vlc in the terminal when finished listening) - I've started using cmus - which is actually a really good terminal based media player, which supports internet radio playback. Really lightweight and has a lot of functionality.

Whenever I'm using my PC, I usually have a few tmux* sessions open in various terminals - one for general stuff and others set up for specific projects/tasks.

In the script to set up my main, 'general' tmux session - I've added an extra pane running cmus. So whenever I start my primary tmux session, cmus is automatically ran in its own pane.

To facilitate playback and playlist management from ANY running terminal, I've set up some handy aliases for several cmus-remote commands.
alias stop='cmus-remote -s'
alias play='cmus-remote -p;cmstat'
There are several others, but you get the idea.
cmstat is a script I wrote in my personal bin/ directory, which uses cmus-remote to get information about the currently playing track and then displays artist/track name information in the terminal.

I've also added some keybinds to dwm** which bind the {fn} + {media keys} to various cmus-remote commands. Allowing me to control playback when I don't have a terminal in focus - e.g. when viewing a GUI application in another tag***!

* - tmux is a terminal multiplexer, similar to GNU Screen - allowing you to control multiple terminal sessions from within a single terminal.
** - dwm is a simple tiling window manager written in C.
*** - Tags in dwm are a similar concept to workspaces/virtual desktops - but are not exactly the same.

Another handy alias I've added since my initial post:
alias bashr='vim ~/.bashrc;. ~/.bashrc'
Which allows me to quickly edit my .bashrc file and immediately apply the changes to the current terminal.

I've set up similar aliases to allow quick edits of configs for other applications like vim, tmux, conky etc etc...

Basically, I'm a lazy git. I'll do anything to make my life that little bit easier. Even if it only saves me from typing one or two extra characters in the terminal.... Scripts, cron-jobs, aliases, keybinds - whatever it takes - nothing is beneath me! XD

Members online

Latest posts