Вы находитесь на странице: 1из 5

Linux Commands

who: Linux who command shows who is logged on to the system. This is a useful command
for a Linux system administrator because they can check how many users currently logged in
the system and who they are.
who am i: who am I shows the ID of the current user.
echo: It is typically used in shell scripts and batch files to output status text to the screen or a
set: Displays, sets, or removes environment variables.
S!T "variable#"string$$
%ariable& Specifies the environment&variable name.
String & Specifies a series of characters to assign to the variable.
Type S!T without parameters to display the current environment variables.
Type S!T variable# without a value to delete variable from the environment.
Type S!T variable#value to assign value to variable. 'e can use (variable( in batch files
whenever you need its value.
cat This is used to display text files on screen
o )opy text files
o )ombine text files
o )reate new text files
o )opy
* cat oldfile.txt + newfile.txt
o Displaying Text
*cat filename
o )ombine text files
cat file, file- + newcombinedfile
o )reate new files
*cat foo.text .write text after pressing enter and to save and exit press ctrl/D0
Mkdir:this command is used to create directory.
Rmdir:this command is used to remove the directory.
ls:Lists the contents of a directory.
o ls 1l this would list each of the files in the current directory and the files permissions,
the si2e of the file, date of the last modification, and the file name or directory. 3elow
is additional information about each of the fields this command lists.
o ls 4 List the contents of your home directory by adding a tilde after the ls command
o ls 5 List the contents of your root directory.
o ls ..5 List the contents of the parent directory.
Pwd: Short for print working directory, pwd is a Linux command to print the directory you6re
currently working in when at the command line.
cd: )hanges the directory.
cd "directory$
o directory& 7ame of the directory user wishes to enter.
o cd .. & 8sed to go back one directory on the ma9ority of all 8nix shells. It is important
that the space be between the cd and the ..
o cd & 'hen in a :orn shell to get back one directory used to go back one directory.
wc: Short for word count, wc displays a count of lines, words, and characters in a file.
!xample&wc tushar.txt
Displays information about the file myfile.txt. 3elow is an example of the output.
; ,< ;= myfile.txt
; # Lines
,< # 'ords
;= # )haracters
PATH: In 87I> 5 Linux file systems, the human&readable address of a resource is defined by
?@TA. Bn 8nix 5 Linux like operating systems, .as well as on DBS 5 'indows and its
descendants0, ?@TA is an environment variable listing a set of paths to directories where
executables may be found.
man: The man command is short for manual and provides in depth information about the
reCuested command or allows users to search for commands related to a particular keyword.
whatis: whatis searches a set of database files containing short descriptions of system
commands for keywords and displays the result on the standard output. Bnly complete word
matches are displayed.
dir: used to list directory contents.
uname: print name of current system.
date: tells us the date and time in Linux.
date 6/D@T! (m5(d5(y(nTID!(A(D(S6
'ould list the time and date in the below format.
D@T! E-5EF5E,
cal: calendar for the month and the year.
cal "month$ "year$
bc: )alculator.
cp: )opies files from one location to another.
example cp 5Downloads5abhishek.txt Templates5abhishek.txt
copies the abhishek.txt file into the templates directory
rm: Deletes a file without confirmation.
mv: Ienames a file or moves it from one directory to another directory.
df: Ieport how much free disk space is available for each mount you have.
apropos: apropos searches a set of database files containing short descriptions of system
commands for keywords and displays the result on the standard output.
awk: Short for @ho, 'einberger, and :ernighan, awk is a script processing language also
known as oawk, gawk, mawk and nawk allows for pattern scanning and processing.
chown: )ommand for system % that changes the owner of a file.
chown chope file.txt
Jive permissions as owner to user chope for the file file.txt
clear: used to clear the command prompt.
cmp: )ompares two files and tells you what line numbers are different.
comm: Select or re9ect lines common to two files.
rep: Kinds text within a file.
sed: Sort for Stream !ditor sed allows you to use pre&recorded commands to make changes to
exit: @llows you to exit from a program, shell or log you out of a 8nix network.