Open all your reddit subscriptions using a single command (alias)

Introduction

The alias command is considered both good and bad. It can sometimes simplify long and complex commands, but on the other hand it can also be misused to hide commands everyone could learn otherwise.

Long time Linux users have been using alias for many commands and scripts. Even the operating system itself uses alias for certain commands e.g ll for ls -alF, la for ls -A and so on. However, this tutorial is not going to be about simplifying existing commands, rather it is going to be about aliasing your reddit subscriptions.

1. Link in .bashrc

Go to .bashrc (hidden file) in your home directory and add following line

source ~/.alias

We do this, because it does not clutter .bashrc file.

2. Create the script

Create a file called .alias in your home directory with following texts (add or delete links, change names based on your own reddit subscription list)

# reddit
alias rlin='chromium-browser http://www.reddit.com/r/linux &'
alias rlinn='chromium-browser http://www.reddit.com/r/linux/new &'
alias rgaming='chromium-browser http://www.reddit.com/r/linux_gaming &'
alias rgentoo='chromium-browser http://www.reddit.com/r/gentoo &'
alias rubuntu='chromium-browser http://www.reddit.com/r/ubuntu &'
alias rlinq='chromium-browser http://www.reddit.com/r/linuxquestions &'
alias rlinqn='chromium-browser http://www.reddit.com/r/linuxquestions/new &'
alias rlashow='chromium-browser http://www.reddit.com/r/LinuxActionShow &'
alias reddit='rlin rlinn rgaming rgentoo rubuntu rlinq rlinqn rlashow'

As you can see, we have given separate names for different reddit links and finally consolidated under a single name (reddit).

All you have to do now is open up a new terminal (so that the .bashrc file gets refreshed) and type reddit. This command should open all your links on chromium-browser (change it to whatever you prefer, or make a variable instead, so that you can change browsers easily).

Conclusion

As we saw, how easy it is to create aliases for links. You can also create aliases for youtube searches, gmail, and pretty much whatever you want to be executed with few and easy commands. I hope this tutorial has given you a starting point to create aliases for different links.

Cheers !!

About these ads

Leave a comment

Filed under Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s