Linux commands
-
Upload
mannu-khani -
Category
Education
-
view
296 -
download
2
description
Transcript of Linux commands
![Page 1: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/1.jpg)
Linux Commands
![Page 2: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/2.jpg)
LS
• List the contents of the folder from which it runs.
• Syntax: ls
• Example:
ls –l
ls -a
![Page 3: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/3.jpg)
MKDIR
• The “mkdir” (Make directory) command create a new directory.
• If directory already exists, it will return an error message
“cannot create folder, folder already exists”.
• Syntax: mkdir directory_name
• Example: mkdir student
![Page 4: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/4.jpg)
CAT
• It is used to create a file with content.
• And can concatenate two or more file contents.
• Syntax: cat > filename
• Example: cat > file1
![Page 5: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/5.jpg)
TOUCH
•It is used to create file without content.
•Syntax: touch filename
•Example: touch file1
![Page 6: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/6.jpg)
CP
•It copies a file from one location to
another location.
•Syntax: cp src_file desti_file
•Example: cp file1 file2
![Page 7: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/7.jpg)
CD
•It is used for changing the directory.
•Syntax: cd dir_name
•Example: cd student
![Page 8: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/8.jpg)
MV
•The “mv” command moves a file from one
location to another location.
•Syntax: mv source destination
•Example: mv file1 student
![Page 9: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/9.jpg)
PWD
•It prints the current working directory
with full path name from terminal.
•Syntax: pwd
![Page 10: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/10.jpg)
WHEREIS
•It is used to locate the Sources and
Manual Pages of the command.
•Syntax: whereis command
•Example: whereis cat
![Page 11: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/11.jpg)
WHATIS
•It is helpful to get brief information about
Linux commands.
•Syntax: whatis command
•Example: whatis cp
![Page 12: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/12.jpg)
WHICH
• It is used to locate executables in the system.
• It allows user to pass several command names as
arguments to get their paths in the system.
• Syntax: which command
• Example: which ls
![Page 13: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/13.jpg)
MAN
•It provides online documentation for all
the possible options with a command and
its usages.
•Syntax: man command
•Example: man cat
![Page 14: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/14.jpg)
INFO
•It provides online documentation for all
the commands but in a better structured
way.
•Syntax: info command
•Example: info cat
![Page 15: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/15.jpg)
WHOAMI
•It is used to find out the current user of
the terminal.
•Syntax: whoami
![Page 16: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/16.jpg)
BC
•It means the basic calculator, used for the
basic calculations.
•Syntax: bc
![Page 17: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/17.jpg)
GREP
•It searches the given file for lines
containing a match to the given strings or
words.
•Syntax: grep word filename
•Example: grep m file2
![Page 18: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/18.jpg)
HEAD
•It prints the first 10 lines of the given file.
•Syntax: head filename
•Example: head stu
![Page 19: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/19.jpg)
TAIL
•It prints the last 10 lines of the given file.
•Syntax: head filename
•Example: head std
![Page 20: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/20.jpg)
TAC
•It prints content of the given file in
reverse order.
•Syntax: tac filename
•Example: tac kk
![Page 21: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/21.jpg)
ECHO
• Prints a text on the standard output.
• However in an interactive script, echo passes the
message to the user through terminal.
• Syntax: echo message
• Example: echo hello class
![Page 22: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/22.jpg)
DF
•Report disk usages of file system.
•Useful for user as well as System
Administrator to keep track of their disk
usages.
•Syntax: df
![Page 23: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/23.jpg)
DU
• Estimate files space usage.
• df only reports usage statistics on file systems,
while ‘du‘, on the other hand, measures
directory contents.
• Syntax: du
![Page 24: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/24.jpg)
PS
•ps (Process) gives the status of running
processes with a unique Id called PID.
•Syntax: ps
![Page 25: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/25.jpg)
ALIAS
• It is a built in shell command that lets you
assign name for a long command or frequently
used command.
• Syntax: alias aliasname command
• Example: alias q=ls-l
![Page 26: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/26.jpg)
UNAME
•The “uname” command stands for Unix
Name, print detailed information about
the machine name, Operating System and
Kernel.
•Syntax: uname
![Page 27: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/27.jpg)
SUDO
•It allows a permitted user to execute a
command as the super user or another
user.
•Syntax: sudo cmd
•Example: sudo passwd
![Page 28: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/28.jpg)
SU
• It is used to run shell with substitute user and group IDs.
• It helps to change login session’s owner without the
owner having to first logout of that session.
• Syntax: su user
• Example: su user1
![Page 29: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/29.jpg)
HISTORY
•It prints the history of long list of
executed commands in terminal.
•Syntax: history
![Page 30: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/30.jpg)
PASSWD
•It is used for changing the passwd.
•You must know the current passwd for the
security reason.
•Syntax: passwd
![Page 31: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/31.jpg)
DATE
•It print the current date and time on the
standard output & can further be set.
•Syntax: date
•To set date: date - -set=‘14 may 2013
13:57’
![Page 32: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/32.jpg)
CAL
•It is used to display calendar of the
present month or any other month.
•Syntax: cal
•Example: 3 1991
![Page 33: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/33.jpg)
CLEAR
•It is used to clear the screen.
•Syntax: clear
![Page 34: Linux commands](https://reader034.fdocuments.net/reader034/viewer/2022042715/558364b2d8b42a9c2b8b4927/html5/thumbnails/34.jpg)
Thank you