Linux Commands List

Linux Commands List

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

CommandExplanation
lsFor listing the directory content
ls –alThis lists all the content in extended information, including the hidden files.
cdChange the current directory to the home directory.
pwdThe current working directory name is printed on the terminal.
mkdirThis command helps create new directories.
Cat > fileNameThe standard input is placed into the file with the help of this command.
moreDisplay the content according to the screen size.
headDisplay the first 10 lines of the file.
tailDisplay the last 10 lines of the file.
touchThis command can update and create files.
rm fileNameRemove command helps to delete files.
rm –r dirNameRemove command can also delete directories with option –r.
cpThis can copy files and directories from one place to other.
mvThis can move the files and can also be used for renaming.
lnCreates a link between files.

Process Management

CommandExplanation
psAll the currently working processes are displayed.
topAll the running processes are displayed.
kill pidThe process is killed by using the process id.
pkill patternThis will only kill processes that match the pattern.
bgEnlist the background and stop jobs.
fgThe most recent job is brought to the foreground.

File Permission

CommandExplanation
chmodGrant various permission to the files with the help of octal. There are various permissions like read, write and execute.

Searching

CommandExplanation
grep This is to detect or search patterns in files.
locateThis is helpful in finding files by their name. Locate uses a pre-created database to find files.
findFind is a better version of locate command to search files on the system.
pgrepSearch the processes for any pattern and display the process ids.

System Info

CommandExplanation
dateDisplays the system date and time.
calDisplay the calendar
uptimeThis can print the system wake time or uptime.
wList information about the user and their activity.
whoamiDisplays the user.
uname –aDisplay system information.
manAll the commands have a user manual, and this command helps to print those manuals.
dfDisplay disk usage.
duThis command prints the space occupied by the various directories.

Compression Commands

CommandsExplanation
gzip fileThis compresses the “file” and creates a “file.gz”
gzip –d file.gzThis is to decompress the “file.gz” and create “file”
tar cf file.tar fileThis is used to create a tar file that stores the actual file.
tar xf file.tarThis is to extract the “file” from the tar file.

Network Commands

CommandsExplanation
ping hostThis command checks the connection of the system with the host and displays the results on the terminal.
whois domainThis command displays whois details for the domain specified.
wget fileHelps download files over the internet.
wget –C fileThis command resumes the stopped download.
dig domainThis provides the DNS details about the domain specified.
dig –x hostThis command is used for reverse lookup.