Understanding Basic and Most Useful Linux Commands

If you are somebody who use Linux or is planning to do so there is something that you have to be familiar with and that is the Linux Terminal which is very much similar to the Command Line in Windows (AKA CMD). Unlike the command line in windows which some users may not even see, the Linux terminal is somewhat more important in a Linux based OS. So if you are using one it’ll be a good idea to learn at least the most important Linux commands. So let us have a look at the frequently used ones.





i)                    SUDO (Super User DO)
In a Linux based system you do not have the power of the super user (AKA THE ROOT) unless you root the system to gain super user power, which is often a bad practice. And there are tons of things that only a super user can perform. So in order to gain the power of a super user, a user who has an administrator level privilege can use the SUDO command. While you use the sudo command you will be prompted to enter your administrator password.

Syntax : sudo {the command you want to run as super user}

Eg         : sudo cp    /etc       /home/user/Desktop

ii)                   PWD
This command prints the full path to the directory that you are currently working in. It is very handy to use when running other commands which might require you to know the folder you are working in.

Syntax : pwd

iii)                 LS (List)
The name says it all, the ls command is used to view the files in the folder that you are currently working in. The ls command is very useful for working in the terminal because it lets you know which files are present in the directory that you are working in.
Syntax: ls –a (lists all files including hidden files)
              ls *.txt (lists all files with the extension .txt)
              ls –r (reverses the order of the files)
              ls –d (Lists directories)
              ls {directory name} (displays the files in the directory)      

Eg       : ls folder_name

iv)                 MKDIR (Make Directory)
mkdir as the name suggests makes a new directory in the folder you are currently in.
Syntax : mkdir my_folder
The above command will make a new directory named my_folder in the folder that you are currently in.

v)                  CD (Change Directory)
The cd command changes the directory in which you are working. It’s quite simple you enter the cd command followed by the path to the directory that you want to be working in.
Syntax: cd .. (Jump back one directory)
               cd ../.. (Jumps back two directories)
               cd / (Used to go back to the root directory)

Eg         : cd /path/to/the/directory

vi)                 RMDIR (Remove Directory)
The ‘rmdir’ command does exactly what you think it will. It simply removes the directory that we point it to.

Syntax : rmdir /path/to/the/directory

vii)               MV
This command will rename a directory.

Syntax : mv old_name new_name



viii)              CP (Copy)
The ‘cp’ command is used to copy a file from one place to another here you have to give two arguments one is the name(or path) of the file you want to copy, and one is the name(path) of the destination file.

Syntax : cp source_file destination_file





Share this:

, , , ,

CONVERSATION

0 comments :

Post a Comment