21 June 2007

Terminal shortcuts in Linux

Filed under: Computers,Linux

Here’s a little tidbit for those users out there who might be new to Linux. Terminal shortcuts.

How many times have you typed sudo apt-get install thiscoolapp since you’ve been using Linux? Or perhaps sudo gedit /etc/X11/xorg.conf? A lot I bet. The xorg one is the worst, because you have to get your left-handed ring finger just right in order to get that capital X…well, I digress.

So, as usual, I’m here to help, and here we are: Terminal shortcuts!

It’s a snap!

First, we’ll create one to edit your xorg.conf file. Then, you’ll be able to make other shortcuts on your own as much as you want!

Step 1: Open up the .bashrc file in your home directory in your favorite text editor. You need to view hidden files and folders in order to see it (CTRL-H in Gnome) , or you can do it from the terminal with the command gedit .bashrc (don’t forget the period in front).

Step 2: Now, scroll to the bottom and type:

alias xorg=”sudo gedit /etc/X11/xorg.conf”

What we’re doing here is telling bash that we’re creating an alias called “xorg”, and when we type that in a terminal window, it will assume we’re saying “sudo gedit /etc/X11/xorg.conf“.

That’s it! Save the file, fire up a terminal window, type xorg and hit enter. BAM! There you go, no fuss, no muss, just a nice window full of xorg.conf goodness!

Now, you don’t have to stop there. You can create as many aliases as you want, just use that same format. Alias name = “thing you want it to do”. However, you can only have one command per alias name. So, if you were to have two different commands under the same alias, bash would throw an error. So make sure you don’t use the same one twice.

Happy Linuxing! :)