5 Useful Linux Command Line tricks For Beginners

Command line short-cuts are an interesting way to keep beginners motivated while working on the Linux command line. It not only keeps them engaged but also gives them the much required confidence to work on Linux command line. This article will present 5 useful command line short-cuts for beginners.

Linux Command Line Short-cuts

1. Use ~ instead of home directory

While working on command line, it happens numerous times that you have to type the path of your home directory. You can save this time by using tilde (~) instead of complete path to your home directory.

Here is an example :

$ cd ~/images/

$ pwd
/home/mylinuxbook/images

So you can see that ~ represents nothing but your home directory.

2. Use > to empty a file

If it is required to empty a file the you can simply use the command > [filename].

Here is an example :

$ cat file_new
Hi, how are you?

$ > file_new

$ cat file_new
$

So you can see that the file file_new was quickly flushed off using >.

3. Use keyboard short-cuts to navigate on the command line

While working with a lengthy command, use

Ctrl+a to go to the beginning of command

Ctrl+e to go to the end of command

Ctrl+ [arrow keys] to move forward and backward – one word at a time.

4. Use cd to come back to your home directory

While on command line, you can jump back to your home directory from anywhere i.e., from any directory in the system. All you have to type is cd.

Here is an example :

$ pwd
/home/mylinuxbook/Downloads/coreutils-8.21

$ cd

$ pwd
/home/mylinuxbook

So you can see that cd command brought the control back to home directory.

5. Quickly turn off or restart the system through the init command.

You can use command line to restart or shut down your system through the init command.

About Himanshu Arora

Himanshu Arora is a software programmer, open source enthusiast and Linux researcher. He writes technical articles for various websites and blogs. Some of his articles have been featured on IBM developerworks, ComputerWorld and in Linux Journal. He is the administrator of the blog and also contributes useful posts on the blog. Visit his google+ profile or mail him at himanshuz.chd[at]MAILSERVER[dot]com (where MAILSERVER=gmail)

Himanshu Arora is a software programmer, open source enthusiast and Linux researcher. He writes technical articles for various websites and blogs. Some of his articles have been featured on IBM developerworks, ComputerWorld and in Linux Journal. He is the administrator of MyLinuxBook and also contributes useful posts on the blog. When he is not busy writing articles, he likes to explore various food joints in his city, explore new hill stations and party at weekends. You can catch him on Google+.