1 / 58

L INUX C OMMAND L INE I NTERFACE

L INUX C OMMAND L INE I NTERFACE. 15-09-2013 G UNAANBAN .G gunaanban@gmail.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 )

damisi
Télécharger la présentation

L INUX C OMMAND L INE I NTERFACE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LINUX COMMAND LINE INTERFACE 15-09-2013 GUNAANBAN.G gunaanban@gmail.com

  2. 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’

  3. 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 ”

  4. COMMANDS • Starting with the basic Command “man ” • ‘man ’ represents Manual. • This command used to give the instructions about the command.

  5. For example, man sudo command gives the instructions about sudo command.

  6. Command “dir “ ‘ dir ‘ stands for directory. It is used to display the files and folders within that directory. It displays file with its extension.

  7. Command – “ mkdir“ • ‘ mkdir ‘ stands for make directory. This command is used to create a directory. The syntax is, mkdirfoldername

  8. 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, rmdirdirectory_name

  9. 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)

  10. Command ls –l: It displays all directory and files along with their user access permissions.

  11. Command – “clear” • “clear” command is used to clean the screen of the terminal window. Before clearing, • After clearing the screen,

  12. Command - “ cd “ • It is used to change the directory. ‘cd‘ stands for change directory. Example given below as cdgisak. • 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.

  13. Command – “ pwd“ • ‘ pwd ‘ stands for print working directory. It is used to display the path of current working directory. The syntax is , pwd

  14. Command –”date” • “date”command is used to display the current system date and time.

  15. Command – “cat” • ‘ cat ’ command is used to create a file. The syntax is cat > filename “ text here “ Ctrl + d • Example is,

  16. Command –”sh” • “ sh” command is used to run the program in the file. The syntax is , shfile_name

  17. 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 , mvold_namenew_name

  18. ‘ mv‘ command used for moving files. The syntax is , mv path1/file path2/

  19. ‘ 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

  20. 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) ”.

  21. 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_filecopied_file

  22. 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.

  23. In the above output, 1a2 says that 1st line is equal and addition to 2 and 3 lines. • In the above output, 3d1 says that 2nd and 3rd line are deleted while copying the file.

  24. 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_filedestination_file

  25. 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.

  26. Command –” find “ • “find” command used to search a file with some constraints. The syntax is, find <option> <size_value>

  27. 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.

  28. Just click enter to see next line… Finally it automatically return to normal window…. It can be stopped by clicking ‘ Ctrl+z ‘.

  29. Command – “sort” • ‘ sort ‘ command is used to display the content of the file in ascending order. The syntax is, sort filename

  30. ‘ sort –b ‘ command ignores the blank space and displays the content of the file in ascending order. The syntax is , sort –b filename

  31. Command – “ greb “ • ‘ greb ‘ command is used to display the same content in 2 different files. The syntax is, greb file1 file2

  32. Command – “ paste “ • ‘ paste ‘ command is used to combine two various file contents. The syntax is, paste file1 file2

  33. Command – ” vi “ • ‘ vi ‘ command used to open a file using Command Line Editor.

  34. 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 “.

  35. To discard the changes and exit the file, enter “ :q “.

  36. Make sure that the file has the permission to write….. Otherwise below output will be shown.

  37. Command – “ rm “ • ‘ rm ‘ command is used to delete a file. The syntax is, rm filename

  38. Command – “ whoami “ • ‘ whoami ‘ command is used to show the current login user name. The syntax is, whoami

  39. 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 ‘.

  40. Command – “ who “ • ‘ who ‘ command is used to display the login users with their terminal details. The syntax is, who

  41. 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 <group> <operation> <mode> filename

  42. File before changing the permissions.

  43. Restricting the reading and writting permission of the file in numerical way.

  44. Opening the file, after restricting the permissions.

  45. Providing permissions to the file in numerical way. • Removing permissions of the file in symbolic way.

  46. 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)

  47. 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.

More Related