LINUX

Basic important Linux commands with example.

  • Linux is the most popular Open Source Operating System.
  • Its code easily available and also anyone contributes,modify the code according to their own purposes.
  • Linux is faster than the Windows OS (operating system).
  • Linux OS is more secure than windows.

LINUX COMMAND

1 . pwd

Linux command pwd means “present working directory”.When we run this command on our linux terminal.Then this command show the path of current working directory from root. For Example :

Here we run “pwd” command in the root and tutorial folder.Therefore its show this path.

2. ls

Linux command ls means “list”.When we run this command on our linux terminal.Then this command show the list of current working directory . For Example :

Here we run the “ls” command in the root ,it will show the list of files.To see hidden files in the run the command “ls -a“.

3. mkdir

Linux command mkdir means “make directory”.When we run this command on our linux terminal.Then this command create new folder in current working directory . For Example :

Here we run the command “mkdir Mongo” .Then it will create the folder of Mongo in current directory.

4. rmdir

Linux command rmdir means “remove directory”.When we run this command on our linux terminal.Then this command delete empty folder in current working directory . For Example :

Here we run the command “rmdir Mongo” .Then it will delete the empty folder of Mongo in current directory.

5. rm / rm -r

Linux command rm means “remove “.When we run this command on our linux terminal.Then this command delete empty folder in current working directory . If You want to delete folder which is contain subfolder .Then Run Command “rm -r” . For Example :

Here we run the command “rm -r ” .Then it will delete the non empty folder of tutorial in current directory.

6. cd

Linux command cd means “change directory”.When we run this command on our linux terminal.Then this command change current working directory to given directory . For Example :

Here we change current root directory to Mysql Directory using “cd” command.

7. cd ..

Linux command cd .. means “move one directory back”.When we run this command on our linux terminal.Then this command change current working directory to one step back directory . For Example :

Here we change current directory (Mysql) to one step back directory(root).

8. cp

Linux command cp means “copy “.It will take two argument first it will path of file or file and second parameter is path of destination where we copy file or folder.When we run this command on our linux terminal.Then this command change current working directory to one step back directory . For Example :

Here we run command “cp” given first argument is what file to be copy and second is where file copy .

9.cat

Linux command cat means “concatenate”.When we run this command on our linux terminal.Then this command display the content of the file. For Example :

10. cat [file1] [file2]

When you want to read multiple file at time then this command run “cat file1 file2”.For Example:

Here above at a time we multiple file read at a time using command “cat “.

11. cat -n [filename]

When you want to display line number in the file run command “cat -n [filename]”. For example:

Here above i run command to display line number of hello.txt.

12. df

Linux command df means “disk free”.When we run this command on our Linux terminal. Then this command displays the free space available in the disk. If you want to show data in megabyte then run the command “df -m”,for kilobyte run command “df -k”. For Example :

13. hostname /hostname -i

Linux command hostname means “show your hostname in network”.When we run this command on our Linux terminal. Then this command displays the hostname of your in computer. If you want to show IP address in megabyte then run the command “hostname -i”. For Example :

14. ping

Linux Command “ping” use to check network connection to the server.It will send data packet to the server and server reply.For example :

Here we ping 127.0.0.1 it will give response .

14. echo [option][string]

Linux command “echo” . When you want to add some text in the file. Run Command “echo hello google >> hey.txt”. For Example :

15. mv [destination]

Linux command mv means “move“.When we run this command on our Linux terminal. Then this command moves our file to a given folder . In move, command take two arguments first is which file or folder to be move, second is destination where be move file or folder. We also move multiple files at a time. For Example :

Here first we move hello.c to Mysql folder,second times we move multiple file to Mysql folder.