Top 20 Linux commands that everyone should know

I develop for Linux for a living, I used to develop for DOS.
Going from DOS to Linux is like trading a glider for an F117.
— Lawrence Foard, entropy@world.std.com

Linux is a UNIX -like free and open source operating system. By free and open source it means that that linux operating systems are free to download (without any charges) along with their source code which is manipulated and developed by thousands of linux enthusiasts or open source communities and released in form of distributions, also called distros for example Arch linux, linux mint, Debian, Ubuntu, Fedora, etc.

linuxLinux interface is pretty user friendly and hence easy to understand but I think apart from that there are few commands that everyone should know in order to get familiar with the terminal which is like command prompt of windows, as it may come handy in future.

Now I believe that you are familiar with downloading linux and already know how to run it as dual boot or in VMware/VirtualBox (recommended). In case you are not familiar with it then click the link given below

How to install Ubuntu in VMware

Now I have listed some commands and their uses, also I would suggest you to refer to screenshots for better understanding.

So the top 20 commands are:-

1. To view your present working directory:

     Command: pwd

     Use: It will display your current directory your working in

        2. To see all directories:

     Commands:                                               Uses:

              ls                                                  To see all the files and folders

              ls –l                                             To see detailed list of files and folder

              ls –a                                            To see all files and folder including hidden

              ls –la                                           Combination of –l and –a .

More generally only ” ls” is used but in case you want more information like date, file permissions, etc. or you want to view hidden files or folders in your terminal then apply “–l” and “–a” attributes to “ls” command respectively.

linux1

3. To navigate through the files and folder:

   a. Command: cd (change directory)

       Use: To enter into a folder or directory by using this command along with path the folder.

   b. Command: cd ..

       Use: To move one level back from your current folder.

   c. Command: cd

       Use: To move back to home directory.

linux2

4. To create a new folder or directory:

    Command: mkdir

    Use: To create a new folder or directory.

linux3

5. To delete a folder or directory:

    Command: rmdir

    Use: To remove or delete the folder or directory

linux4

6. To create a file:

    Command: touch filename

    Use: To create a blank text file, use touch command along with file name.

linux5

7. To remove a file:

     Command: rm filename

     Use: To delete the particular file or text file.

8. Copy a file:

   Command: cp filename1 filename2

   Use: To create an exact copy of filename1 which is named as filename2.

linux6

9. To move a file:

  Command: mv

 Use: It moves a file from one folder or location to another folder or location. It first creates a copy   of the file at another location with same name and deletes the original file.

10. To rename a file:

Command: mv filename1 filename2

Use: According to above concept of moving a file it creates a copy of the file at same location with different name.

11. To search a word in a file:

    Command: grep word filename

    Use: It searches a particular word in a given file and displays the lines where it was found

12. To compare two files:

       Command: diff filename1 filename2

       Use: It compares the two given file line by line and any line different in the two files is displayed

13. To display a line or output a variable:

Command: echo

Use: Probably it is the stupidest command until now because it just displays the same line you have typed under echo command again on the screen. Also it can display the variable content in the terminal, but it is quite useful in shell scripting.

14. Complete information on a command:

Command: info commandname

Use: It displays all the information available on a particular command that you would want to know.

15. To compress a file:

       Command: gzip filename

       Use: It compress the file in .gz format

linux7

16. To extract a file:

       Command: gunzip filename.gz

       Use: Extracts the .gz file

17. To compress multiple files:

       Command: tar cvf file.tar filename1 filename2 filename3

       Use: It will create file.tar which will compress 3 files similar to .zip file in windows

linux8

18. To extract files from .tar file:

    Command: extract xvf file .tar

    Use:It is similar to .zip in windows so in the same way it will extract the multiple files from .tar file

19. To run a shell script (.sh file):

      Command: bash filename.sh

      Use: To execute a shell script file

20. To install a software using apt (advanced package tool):

       Command: sudo apt –get softwarename

       Use: To install a software using apt command in terminal

There are many more commands like clear, cat, chmod, etc. that everyone should know about but I think at least these basic commands that are applicable in any linux distro.

Thanks for reading and I hope this helps. For any query comment down bellow.

You can follow me on Google+ by clicking on the link below

www.google.com/+AkarshSinghOriginals

Written by Akarsh Singh 

     P_20151110_184408_BF

5 Comments on “Top 20 Linux commands that everyone should know

  1. Hello there! Would you mind if I share your blog
    with my facebook group? There’s a lot of folks that I think would
    really enjoy your content. Please let me know. Thank you

  2. Howdy just wanted to give you a quick heads up.

    The words in your content seem to be running off the
    screen in Internet explorer. I’m not sure if this is a format issue or something to do with internet
    browser compatibility but I thought I’d post to let you know.
    The layout look great though! Hope you get the problem resolved soon.
    Many thanks

Leave a Reply

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