5 Useful Linux Command Line tricks For Beginners

By | 19/08/2013

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.

All you have to do is :

  • init 0 to shut the system down
  • init 6 to restart the system

 

Want to Learn some really interesting command line tricks? Read our article on 20 interesting and useful Linux command line tips and tricks.

One thought on “5 Useful Linux Command Line tricks For Beginners

  1. Sridevi

    Hi,
    I am a new bee for Linux. Please send me the basic commands which will be helpful to speed up my work.
    Thanks in advance.
    Sridevi

    Reply

Leave a Reply

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