The Linux systems are filled with commands for several use cases. We have divided these commands into some of the most common implementations for a better understanding of these commands.
These are some of those categories.
File Commands
Process Management
File Permission
Searching
System Info
Compression
Network
File Commands
Command
Explanation
ls
For listing the directory content
ls –al
This lists all the content in extended information, including the hidden files.
cd
Change the current directory to the home directory.
pwd
The current working directory name is printed on the terminal.
mkdir
This command helps create new directories.
Cat > fileName
The standard input is placed into the file with the help of this command.
more
Display the content according to the screen size.
head
Display the first 10 lines of the file.
tail
Display the last 10 lines of the file.
touch
This command can update and create files.
rm fileName
Remove command helps to delete files.
rm –r dirName
Remove command can also delete directories with option –r.
cp
This can copy files and directories from one place to other.
mv
This can move the files and can also be used for renaming.
ln
Creates a link between files.
Process Management
Command
Explanation
ps
All the currently working processes are displayed.
top
All the running processes are displayed.
kill pid
The process is killed by using the process id.
pkill pattern
This will only kill processes that match the pattern.
bg
Enlist the background and stop jobs.
fg
The most recent job is brought to the foreground.
File Permission
Command
Explanation
chmod
Grant various permission to the files with the help of octal. There are various permissions like read, write and execute.
Searching
Command
Explanation
grep
This is to detect or search patterns in files.
locate
This is helpful in finding files by their name. Locate uses a pre-created database to find files.
find
Find is a better version of locate command to search files on the system.
pgrep
Search the processes for any pattern and display the process ids.
System Info
Command
Explanation
date
Displays the system date and time.
cal
Display the calendar
uptime
This can print the system wake time or uptime.
w
List information about the user and their activity.
whoami
Displays the user.
uname –a
Display system information.
man
All the commands have a user manual, and this command helps to print those manuals.
df
Display disk usage.
du
This command prints the space occupied by the various directories.
Compression Commands
Commands
Explanation
gzip file
This compresses the “file” and creates a “file.gz”
gzip –d file.gz
This is to decompress the “file.gz” and create “file”
tar cf file.tar file
This is used to create a tar file that stores the actual file.
tar xf file.tar
This is to extract the “file” from the tar file.
Network Commands
Commands
Explanation
ping host
This command checks the connection of the system with the host and displays the results on the terminal.
whois domain
This command displays whois details for the domain specified.
wget file
Helps download files over the internet.
wget –C file
This command resumes the stopped download.
dig domain
This provides the DNS details about the domain specified.