Presentation is loading. Please wait.

Presentation is loading. Please wait.

L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.G

Similar presentations


Presentation on theme: "L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.G"— Presentation transcript:

1 L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.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 C OMMANDS 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, mkdir foldername

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, rmdir directory_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 “ 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.

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, sh file_name

17 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

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 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_file copied_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 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.

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_file destination_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

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

29

30

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

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

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

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

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

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

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

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

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

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

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

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

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

44 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

45 File before changing the permissions.

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

47 Opening the file, after restricting the permissions.

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

49 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)

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

51 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….

52 Command – ” adduser “ ‘ adduser ‘ command is used to add a new user to the system. The syntax is, adduser username

53 Command – “ passwd “ ‘ passwd ‘ command used to change the password of the user. The syntax is, passwd username

54 Command – “ userdel “ ‘ userdel ‘ command is used to delete the user id. The Syntax is, userdel username

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

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

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

58 Thank you


Download ppt "L INUX C OMMAND L INE I NTERFACE 15-09-2013 G UNAANBAN.G"

Similar presentations


Ads by Google