0% found this document useful (0 votes)
18 views

Linux Commands

The document lists 50 common Linux commands, their syntax, and brief descriptions of their uses. Some key commands include: whoami - to print the username of the logged in user ls - to see files and folders in the current or specified directory cd - to change directories mkdir - to create new directories rm - to remove or delete files

Uploaded by

qwerty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Linux Commands

The document lists 50 common Linux commands, their syntax, and brief descriptions of their uses. Some key commands include: whoami - to print the username of the logged in user ls - to see files and folders in the current or specified directory cd - to change directories mkdir - to create new directories rm - to remove or delete files

Uploaded by

qwerty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Sheet1

Most used Linux commands


No Command Syntax Uses
1 whoami $ whoami to print username currently logged into terminal session
2 man $ man <command name> to help understand how to use command (Manual)
3 clear $ clear to clear terminal screen
4 pwd $ pwd to print the current folder path
5 ls $ ls <folder name/ folder path> to see all the files and folder in current folder or path folder
6 cd $ cd <folder name/ folder path> to change folder or directory using folder name or folder path
7 mkdir $ mkdir <folder name/ path for create dir.> to create directory in current folder or in given path.
to create an empty file or open file in write mode if already
8 touch $ touch <file name/ file path>
exists and the timestamp of the file is updated.
9 rmdir $ rmdir <folders name/ folder path> to remove only empty directory or rm for remove file and folder
10 rm $ rm <files name/ file path> to remove file and folder from current folder or path folder
11 open $ xdg-open <file name/ folder name> to open particular file or folder (linux)
12 mv $ mv <files/folder name> <file name-2/ folder path> to move file or folder to given path Or rename of file or folder
to copy files and folder in given folder or folder path (use -r for
13 cp $ cp <files/folder name> <file name-2/ folder path>
copy folder)
14 head $ head <file name/ file path> to see the first part of files
15 tail $ tail <file name/ file path> to see the last part of files
16 date $ date to know date and time
to save the output of commands, it is always override of past
17 > $ command > <file name/ file path>
output
to save the output of commands, it is always append of past
18 >> $ command >> <file name/ file path>
output
19 cat $ cat <files name/ file path> to concatenate files and print on the standard output
20 less $ less <file name/ file path> to see the content stored inside a file
21 echo $ echo < ”message” > to print to the output the argument passed to it
22 wc $ wc <file name/ file path> to print newline, word, and byte counts for each file
23 sort $ sort <file name/ file path> to sorting data of file, it is only see not update in file
to useful to sort uniq lines of text. No include repeated lines.
24 uniq $ uniq <file name/ file path>
Use with sort using piped (“ | ”).
25 diff $ diff <file name/ file path> <file name/ file path> to see the difference between two files.
26 find $ find <location> <option> <condition/ filter> to search for files in a directory hierarchy
27 grep $ grep <option> <pattern> <file name/ file path> to print lines that match patterns (find inside of file)
28 du $ du <option> to calculate the size of a directory as a whole.
29 df $ df <option> to get disk usage information
30 history $ history to see history of previous run command
31 ps $ ps to inspect running all the different processes.
to display dynamic real time information about running
32 top $ top
processes in the system
33 kill $ kill <signal flag> <PID> to send a variety of signals to a program to terminate
to to sending signal to a specific process id will send the signal
34 killall $ killall <name>
to multiple processes at once
35 jobs $ jobs
you can resume the execution of the command in the
36 bg $ bg
background
37 fg $ fg to resume to the foreground the last jobs that was suspended
38 sleep $ sleep <time in sec> to delay for a specified amount of time
to compress the file and append a .gz extension to it. The
39 gzip $ gzip <files name/ files path>
origional file deleted.
40 tar $ tar -cf <achived name in (.tar)> <files name list> to create an achive, grouping multiple files in a single file
41 nano $ nano <file name> it is beginner friendly editor.
42 alias $ alias <alias name=’alias command’> to define own alias or custom command. It is temporary.
the output of a command is used as the input of another
43 xargs $ <command-1> | xargs <command-2>
command
44 ln $ ln <original> <link> to create a links (a file that points to another file)
45 who $ who to display the users logged in to the system
46 su $ su <username> to use for switch user
47 sudo $ sudo <command> commanly used to run a command as root
48 passwd $ passwd to change the password
49 chown $ chown <new owner name> <file name/ file path> the owner can change the owner to another user, too
50 chmod $ chmode <mode> <file name/ folder name> to change mode of files and folder like read, write, execute

Page 1

You might also like