Presentation on theme: "L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.G"— Presentation transcript:
L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.G email@example.com
What is Command Line Interface in Linux? Actually it’s a terminal. Which is a command prompt in Windows. Two kind of terminals are there. They are, Terminal Emulator GUI (Alt+Ctrl+T) Text Based terminal (Alt+Ctrl+F1 / F2 / F3 / F4 / F5 / F6) “ / ” - represents ‘or’
Text based terminal can be used by six or less no. of users at a time. While entering into each terminal it will ask for user name and password to identify particular user. Same user can work on different terminals at a time. To exit from terminal to Graphical User Interface the below shortcut key is used “ Alt+Ctrl+F7 ”
C OMMANDS Starting with the basic Command “ man ” ‘ man ’ represents Manual. This command used to give the instructions about the command.
For example, man sudo command gives the instructions about sudo command.
Command “ dir “ ‘ dir ‘ stands for directory. It is used to display the files and folders within that directory. It displays file with its extension.
Command – “ mkdir “ ‘ mkdir ‘ stands for make directory. This command is used to create a directory. The syntax is, mkdir foldername
Command – ”rmdir” “rmdir” stands for remove directory. This is used to remove the directory. Make sure that the directory should be empty. The syntax is, rmdir directory_name
Command - “ ls “ It displays a list of files in the current directory in alphabetical order. It also differentiate the file name using colors with respect to their permissions. This command can be used with some options like “ ls –a ” and “ ls –l ”. Command ls –a : ( It displays all directory including hidden files)
Command ls –l : It displays all directory and files along with their user access permissions.
Command – “ clear ” “ clear ” command is used to clean the screen of the terminal window. Before clearing, After clearing the screen,
Command - “ cd “ cd. It is used to change the directory. ‘ cd ‘ stands for change directory. Example given below as cd gisak. ““ The command “ cd. “ is used to stay on the same directory. “ “ The command “ cd.. “ is used to go back to the previous directory. “ ” The command “ cd ” is also used to redirect to the home directory.
Command – “ pwd “ ‘ pwd ‘ stands for print working directory. It is used to display the path of current working directory. The syntax is, pwd
Command – ”date” “date” command is used to display the current system date and time.
Command – “ cat ” ‘ ’ ‘ cat ’ command is used to create a file. The syntax is cat > filename “ text here “ Ctrl + d Example is,
Command – ”sh” “ sh” command is used to run the program in the file. The syntax is, sh file_name
Command – mv Command – “ mv “ ‘ mv ‘ command is used to rename the file and also move a file from one directory to another. The syntax for renaming a file, mv old_name new_name
‘ mv ‘ command used for moving files. The syntax is, mv path1/file path2/
‘ cat ‘ command is used to view the content of the file. The syntax is, cat filename ‘ cat ‘ command also used to concatenate two files and redirect the output to another file. The syntax is, cat file1 file2 > outputfile
Command – cmp Command – “ cmp ” ‘ cmp ‘ command is used to display the difference between the contents of the two files. The syntax is, cmp file1 file2 In the above example, the output shows that, “ the variation starts from the sixth character(byte 6) in the first line(line 1) ”.
Command – “ diff ” ‘ diff ‘ command is used to give the changes in the files while copying one directory to another. It have three different ways in describing difference between the files. They are, Changed to, Addition to, Deleted to. The syntax is, diff original_file copied_file
In the above output, 3c1 says that 3 line changed to a single line while copying the file. 1c1 says that 1 line is changed upto 3 line.
In the above output, 1a2 says that 1 st line is equal and addition to 2 and 3 lines. In the above output, 3d1 says that 2 nd and 3 rd line are deleted while copying the file.
Command – “ cp “ ‘ cp ‘ stands for copy. This command is used to copy the content of the one file to another file. The syntax is, cp source_file destination_file
Command – “ wc “ ‘ wc ‘ stands for word count. It is used to count the content of the file. The syntax is, wc filename ‘ wc –l ‘ is used to display no. of line in the file. ‘ wc –c ‘ is used to display no. of characters in the file. ‘ wc –w ‘ is used to display no. of words in the file.
Command – ” find “ “find” command used to search a file with some constraints. The syntax is, find
Command – “ more “ ‘ more ‘ command is used display the large content file in the terminal window by percentage basis. The syntax is, more filename The percentage based examples for more command is given below.
Just click enter to see next line… Finally it automatically return to normal window…. It can be stopped by clicking ‘ Ctrl+z ‘.
Command – “sort” ‘ sort ‘ command is used to display the content of the file in ascending order. The syntax is, sort filename
‘ sort –b ‘ command ignores the blank space and displays the content of the file in ascending order. The syntax is, sort –b filename
Command – “ greb “ ‘ greb ‘ command is used to display the same content in 2 different files. The syntax is, greb file1 file2
Command – “ paste “ ‘ paste ‘ command is used to combine two various file contents. The syntax is, paste file1 file2
Command – ” vi “ ‘ vi ‘ command used to open a file using Command Line Editor.
We can edit the file by clicking the ‘insert’ button on the keyboard. After editing the file, click the ‘insert’ button again. After changing text in the file, save the file and exit. enter “ :wq “.
To discard the changes and exit the file, enter “ :q “.
Make sure that the file has the permission to write….. Otherwise below output will be shown.
Command – “ rm “ ‘ rm ‘ command is used to delete a file. The syntax is, rm filename
Command – “ whoami “ ‘ whoami ‘ command is used to show the current login user name. The syntax is, whoami
Command – “ su ” ‘ su ‘ stands for super user. It is used for login from one user to another. More likely log off method. ‘ su –l’ command is used for switch user login to root login. Then it ask for root password. To come back to normal use the command ‘ logout ‘.
Command – “ who “ ‘ who ‘ command is used to display the login users with their terminal details. The syntax is, who
Command – “ chmod “ ‘ chmod ‘ stands for change mode. This command is used to change the file permissions. This command offers symbolic and numerical way for changing the modes. The syntax is, chmod filename
Restricting the reading and writting permission of the file in numerical way.
Opening the file, after restricting the permissions.
Providing permissions to the file in numerical way. Removing permissions of the file in symbolic way.
Providing permissions to the file in symbolic way. In changing the group, it has 3 types. They are, User, Group, Other. In Operations,it also has 3 types. They are, +, -, = In changing the modes, it also has 3 types. They are, read(4), write(2), and execute(1)
Command – “ | “ ‘ | ‘ is a pipeline command. It is used to join 2 commands. It displays 4 users are working on different terminals at the same time.
Command – “ wall “ ‘ wall ‘ command is used to display messages to all the users on different terminals at a same time. The syntax is, wall Sender side… Receiver side….
Command – ” adduser “ ‘ adduser ‘ command is used to add a new user to the system. The syntax is, adduser username
Command – “ passwd “ ‘ passwd ‘ command used to change the password of the user. The syntax is, passwd username
Command – “ userdel “ ‘ userdel ‘ command is used to delete the user id. The Syntax is, userdel username
Command – ”sudo passwd root” ‘sudo passwd root’ command is used to change the passwd of the root from the user by using super user facility. In this user must have the administrator permissions. Guest users are not allowed to change this.
Command – ”shutdown” “shutdown” command is used to halt or stop all the system processes. The syntax is, shutdown “shutdown –r now” command is used to restart the computer. “shutdown –h now” command is used to shutdown or suspend the computer. The Admin user “root” can only use this commands.
Command – ”init” ‘init’ command is also used in halting the system performance. The syntax is, init “init 0” Command is used to shutdown or suspend the computer. This command is also only used by the root user.