Introduction to Linux CLI
- Mohammad Abu Mattar
- Linux
- 19 Oct, 2022
- 51 Mins read
Introduction
The Linux operating system family is a group of free and open-source Unix systems. They consist of Red Hat, Arch Linux, Ubuntu, Debian, openSUSE, and Fedora. You must utilize a shell when using Linux, an application that allows you access to the system’s features. The majority of Linux distributions have a graphical user interface (GUI), which makes them user-friendly for beginners. I advise using the command-line interface (CLI), as it is speedier and gives you more control. By putting commands into the CLI, tasks that take many steps on the GUI may be completed in a matter of seconds.
What Is a Linux Command?
An application or tool that runs on the CLI, a console that communicates with the system via text and processes, is known as a Linux command. It resembles Windows’ Command Prompt program in many ways. By hitting Enter at the end of the line, Linux commands are run on the terminal. You may use commands to carry out a range of operations, including managing users, installing packages, and manipulating files.
The general syntax of a Linux command is as follows:
CommandName [flag(s)] [parameter(s)]
- CommandName is the name of the command you want to run.
- Flag(s) are optional arguments that modify the behavior of the command.
- Parameter(s) are required arguments that specify the command’s input.
Note: Remember that case affects the syntax of every Linux command.
File Management
Every system administrator should be familiar with the very basic commands listed in this section. This collection of Linux commands for managing files is undoubtedly incomplete, but it can serve as a starting point and cover the majority of simple to complicated situations.
pwd
The pwd
command is used to print the current working directory. The working directory is the directory you are currently in. The output of the pwd
command is the path to the working directory.
pwd
Flags
-L
- If the current working directory is a symbolic link, print the path of the symbolic link.-P
- If the current working directory is a symbolic link, print the path of the symbolic link’s target.
ls
ls
is A system’s files and directories are listed using the ls
command. It will display the contents of the current working directory when run without a flag or argument.
ls
Flags
-a
- List all files, including hidden files.-l
- List files in long format.-h
- List files in human-readable format.-r
- List files in reverse order.-t
- List files by the time they were last modified.
cd
The cd
command is used to change the current working directory. It takes a directory as an argument. The output of the cd
command is the new working directory.
mkdir
The mkdir
command is used to create a new directory. It takes a directory name as an argument. The output of the mkdir
command is the newly created directory.
mkdir
Flags
-p
- Create parent directories as needed.
touch
The touch
command is used to create a new file. It takes a file name as an argument. The output of the touch
command is the newly created file.
touch
Flags
-a
- Change the access time of the file.-m
- Change the modification time of the file.-t
- Change the access and modification times of the file.
cp
The cp
command is used to copy files and directories. It takes the source and destination as arguments. The output of the cp
command is the copied file or directory.
cp
Flags
-r
- Copy directories recursively.
mv
The mv
command is used to move files and directories. It takes the source and destination as arguments. The output of the mv
command is the moved file or directory.
mv
Flags
-i
- Prompt before overwriting an existing file.-f
- Force the move of a file, even if it already exists.-u
- Move a file only if the source file is newer than the destination file.
rm
The rm
command is used to remove files and directories. It takes the file or directory as an argument. The output of the rm
command is the removed file or directory.
rm
Flags
-r
- Remove directories and their contents recursively.-f
- Force remove files without prompting for confirmation.
rmdir
The rmdir
command is used to remove empty directories. It takes the directory as an argument. The output of the rmdir
command is the removed directory.
rmdir
Flags
-p
- Remove parent directories as needed.
cat
The cat
command is used to display the contents of a file. It takes a file as an argument. The output of the cat
command is the contents of the specified file.
cat
Flags
-n
- Number all output lines.
more
The more
command is used to display the contents of a file. It takes a file as an argument. The output of the more
command is the contents of the specified file.
more
Flags
-d
- Display the contents of the file “file” and number all output lines.
less
The less
command is used to display the contents of a file. It takes a file as an argument. The output of the less
command is the contents of the specified file.
less
Flags
-N
- Display the contents of the file “file” and number all output lines.
head
The head
command is used to display the first 10 lines of a file. It takes a file as an argument. The output of the head
command is the first 10 lines of the specified file.
head
Flags
-n
- Display the first n lines of the file “file”.
tail
The tail
command is used to display the last 10 lines of a file. It takes a file as an argument. The output of the tail
command is the last 10 lines of the specified file.
tail
Flags
-n
- Display the last n lines of the file “file”.
Finding files and directories
The find command will be used the majority of the time to locate files and folders. But I also enjoy the which command since it provides the binary’s path, which is necessary on several occasions when we must run a binary with a complete PATH.
find
The find
command is used to find files and directories. It takes a directory as an argument. The output of the find
command is the files and directories that match the specified criteria.
find
Flags
-name
- Find files and directories with the specified name.-type
- Find files and directories of the specified type.-size
- Find files and directories of the specified size.-mtime
- Find files and directories that have been modified in the specified number of days.-exec
- Execute the specified command on the found files and directories.
locate
The locate
command is used to find files and directories. It takes a file or directory name as an argument. The output of the locate
command is the files and directories that match the specified criteria.
locate
Flags
-i
- Find files and directories with the specified name, ignoring case.
which
The which
command is used to find the location of a command. It takes a command as an argument. The output of the which
command is the location of the specified command.
which
Flags
-a
- Find all locations of the specified command.-s
- Find the location of the specified command and return a status code of 0 if the command is found and 1 if the command is not found.
whereis
The whereis
command is used to find the location of a command. It takes a command as an argument. The output of the whereis
command is the location of the specified command.
whereis
Flags
-b
- Find the location of the specified command and return a status code of 0 if the command is found and 1 if the command is not found.
Check User Information
These are a few of the commands we employ to verify the details of the most recent person to log in, as well as a few others to obtain further information regarding an existing user.
whoami
The whoami
command is used to display the current user. It takes no arguments. The output of the whoami
command is the current user.
whoami
Flags
-u
- Display the current user and return a status code of 0 if the user is found and 1 if the user is not found.
who
The who
command is used to display the current users. It takes no arguments. The output of the who
command is the current users.
who
Flags
-u
- Display the current users and return a status code of 0 if the users are found and 1 if the users are not found.
w
The w
command is used to display the current users. It takes no arguments. The output of the w
command is the current users.
w
Flags
-u
- Display the current users and return a status code of 0 if the users are found and 1 if the users are not found.
id
The id
command is used to display the current user. It takes no arguments. The output of the id
command is the current user.
id
Flags
-u
- Display the current user and return a status code of 0 if the user is found and 1 if the user is not found.
groups
The groups
command is used to display the current user’s groups. It takes no arguments. The output of the groups
command is the current user’s groups.
Managing Users and Groups
These are some of the fundamental Linux commands for managing users, including adding, editing, and removing individuals or groups.
useradd
The useradd
command is used to add a user. It takes a username as an argument. The output of the useradd
command is the user that was added.
useradd
Flags
-c
- Add a user with the specified comment.-d
- Add a user with the specified home directory.-g
- Add a user with the specified primary group.-G
- Add a user with the specified supplementary groups.-m
- Add a user with the specified home directory.-s
- Add a user with the specified shell.-u
- Add a user with the specified user ID.
userdel
The userdel
command is used to delete a user. It takes a username as an argument. The output of the userdel
command is the user that was deleted.
userdel
Flags
-r
- Delete a user with the specified home directory.
usermod
The usermod
command is used to modify a user. It takes a username as an argument. The output of the usermod
command is the user that was modified.
usermod
Flags
-c
- Modify a user with the specified comment.-d
- Modify a user with the specified home directory.-e
- Modify a user with the specified expiration date.-g
- Modify a user with the specified primary group.-G
- Modify a user with the specified supplementary groups.-l
- Modify a user with the specified username.-m
- Modify a user with the specified home directory.-s
- Modify a user with the specified shell.-u
- Modify a user with the specified user ID.
passwd
The passwd
command is used to change a user’s password. It takes a username as an argument. The output of the passwd
command is the user’s password that was changed.
passwd
Flags
-d
- Change a user’s password with the specified username and delete the password.-e
- Change a user’s password with the specified username and expire the password.-l
- Change a user’s password with the specified username and lock the password.-u
- Change a user’s password with the specified username and unlock the password.
groupadd
The groupadd
command is used to add a group. It takes a group name as an argument. The output of the groupadd
command is the group that was added.
groupadd
Flags
-g
- Add a group with the specified group ID.-r
- Add a group with the specified system group.-f
- Add a group with the specified force.
groupdel
The groupdel
command is used to delete a group. It takes a group name as an argument. The output of the groupdel
command is the group that was deleted.
groupdel
Flags
-f
- Delete a group with the specified force.
groupmod
The groupmod
command is used to modify a group. It takes a group name as an argument. The output of the groupmod
command is the group that was modified.
groupmod
Flags
-g
- Modify a group with the specified group ID.-n
- Modify a group with the specified group name.
Managing Permissions
I have simply addressed the fundamental commands that we use to assign, change, and remove rights from files and directories because the topic of Linux permissions is rather broad.
chown
The chown
command is used to change the owner of a file or directory. It takes a username and a file or directory as arguments. The output of the chown
command is the file or directory that was changed.
chown
Flags
-R
- Change the owner of a file or directory with the specified recursive.-c
- Change the owner of a file or directory with the specified verbose.-f
- Change the owner of a file or directory with the specified force.-h
- Change the owner of a file or directory with the specified symbolic links.-v
- Change the owner of a file or directory with the specified verbose.
chgrp
The chgrp
command is used to change the group of a file or directory. It takes a group name and a file or directory as arguments. The output of the chgrp
command is the file or directory that was changed.
chgrp
Flags
-R
- Change the group of a file or directory with the specified recursive.-c
- Change the group of a file or directory with the specified verbose.-f
- Change the group of a file or directory with the specified force.-h
- Change the group of a file or directory with the specified symbolic links.-v
- Change the group of a file or directory with the specified verbose.
chmod
The chmod
command is used to change the permissions of a file or directory. It takes a permission and a file or directory as arguments. The output of the chmod
command is the file or directory that was changed.
Note: The
chmod
command can also be used to change the permissions of a file or directory using the symbolic notation. 777 is the same asrwxrwxrwx
. The first character is for the owner, the second character is for the group, and the third character is for everyone else. 7 is the same asrwx
. 6 is the same asrw-
. 5 is the same asr-x
. 4 is the same asr--
. 3 is the same as-wx
. 2 is the same as-w-
. 1 is the same as--x
. 0 is the same as---
.
chmod
Flags
-R
- Change the permissions of a file or directory with the specified recursive.-c
- Change the permissions of a file or directory with the specified verbose.-f
- Change the permissions of a file or directory with the specified force.-h
- Change the permissions of a file or directory with the specified symbolic links.-v
- Change the permissions of a file or directory with the specified verbose.
newgrp
The newgrp
command is used to change the group of the current user. It takes a group name as an argument. The output of the newgrp
command is the group that was changed.
newgrp
Flags
-
- Change the group of the current user with the specified login shell.-l
- Change the group of the current user with the specified login shell.-s
- Change the group of the current user with the specified login shell.
setfacl
The setfacl
command is used to set the access control list of a file or directory. It takes a file or directory as an argument. The output of the setfacl
command is the file or directory that was changed.
setfacl
Flags
-m
- Set the access control list of a file or directory with the specified modify.-x
- Set the access control list of a file or directory with the specified remove.-b
- Set the access control list of a file or directory with the specified remove all.-k
- Set the access control list of a file or directory with the specified remove default.-R
- Set the access control list of a file or directory with the specified recursive.-c
- Set the access control list of a file or directory with the specified verbose.-f
- Set the access control list of a file or directory with the specified force.-h
- Set the access control list of a file or directory with the specified symbolic links.-v
- Set the access control list of a file or directory with the specified verbose.
umask
The umask
command is used to set the default permissions of a file or directory. It takes a permission as an argument. The output of the umask
command is the permission that was changed.
umask
Flags
-S
- Set the default permissions of a file or directory with the specified symbolic notation.
getfacl
The getfacl
command is used to get the access control list of a file or directory. It takes a file or directory as an argument. The output of the getfacl
command is the access control list of the file or directory.
getfacl
Flags
-R
- Get the access control list of a file or directory with the specified recursive.-c
- Get the access control list of a file or directory with the specified verbose.-f
- Get the access control list of a file or directory with the specified force.-h
- Get the access control list of a file or directory with the specified symbolic links.-v
- Get the access control list of a file or directory with the specified verbose.
chattr
The chattr
command is used to change the attributes of a file or directory. It takes a file or directory as an argument. The output of the chattr
command is the file or directory that was changed.
chattr
Flags
-i
- Change the attributes of a file or directory with the specified immutable.-a
- Change the attributes of a file or directory with the specified append only.-A
- Change the attributes of a file or directory with the specified no append.-d
- Change the attributes of a file or directory with the specified no dump.-D
- Change the attributes of a file or directory with the specified dump.-e
- Change the attributes of a file or directory with the specified extent.-E
- Change the attributes of a file or directory with the specified no extent.-h
- Change the attributes of a file or directory with the specified no follow.-H
- Change the attributes of a file or directory with the specified follow.-j
- Change the attributes of a file or directory with the specified data journaling.-J
- Change the attributes of a file or directory with the specified no data journaling.-s
- Change the attributes of a file or directory with the specified secure deletion.-S
- Change the attributes of a file or directory with the specified no secure deletion.-t
- Change the attributes of a file or directory with the specified notail.-T
- Change the attributes of a file or directory with the specified tail.-u
- Change the attributes of a file or directory with the specified undelete.-U
- Change the attributes of a file or directory with the specified no undelete.-v
- Change the attributes of a file or directory with the specified verbose.
lsattr
The lsattr
command is used to list the attributes of a file or directory. It takes a file or directory as an argument. The output of the lsattr
command is the attributes of the file or directory.
lsattr
Flags
-R
- List the attributes of a file or directory with the specified recursive.-a
- List the attributes of a file or directory with the specified all.-d
- List the attributes of a file or directory with the specified directory.-h
- List the attributes of a file or directory with the specified symbolic links.-l
- List the attributes of a file or directory with the specified long format.-v
- List the attributes of a file or directory with the specified verbose.
Check System Information
You must be acquainted with these commands if you want to be a system and Linux administrator. These, such as load, CPU model, hardware model, hardware type, etc., will assist you in identifying the sort of server you are using.
uptime
The uptime
command is used to display the system uptime. It takes no arguments. The output of the uptime
command is the system uptime.
uptime
Flags
-p
- Display the system uptime with the specified pretty format.-s
- Display the system uptime with the specified since.-V
- Display the system uptime with the specified version.
uname
The uname
command is used to display the system information. It takes no arguments. The output of the uname
command is the system information.
uname
Flags
-a
- Display the system information with the specified all.-m
- Display the system information with the specified machine.-n
- Display the system information with the specified nodename.-r
- Display the system information with the specified kernel release.-s
- Display the system information with the specified kernel name.-v
- Display the system information with the specified kernel version.
lscpu
The lscpu
command is used to display the CPU information. It takes no arguments. The output of the lscpu
command is the CPU information.
lscpu
Flags
-a
- Display the CPU information with the specified all.-e
- Display the CPU information with the specified extended.-h
- Display the CPU information with the specified human-readable.-i
- Display the CPU information with the specified size in bytes.-p
- Display the CPU information with the specified physical.-x
- Display the CPU information with the specified XML.
lspci
The lspci
command is used to display the PCI information. It takes no arguments. The output of the lspci
command is the PCI information.
lspci
Flags
-a
- Display the PCI information with the specified all.-b
- Display the PCI information with the specified brief.-d
- Display the PCI information with the specified device.-D
- Display the PCI information with the specified dump.-k
- Display the PCI information with the specified kernel.-n
- Display the PCI information with the specified numeric.-s
- Display the PCI information with the specified slot.-t
- Display the PCI information with the specified tree.-v
- Display the PCI information with the specified verbose.
lsusb
The lsusb
command is used to display the USB information. It takes no arguments. The output of the lsusb
command is the USB information.
lsusb
Flags
-a
- Display the USB information with the specified all.-b
- Display the USB information with the specified brief.-d
- Display the USB information with the specified device.-D
- Display the USB information with the specified dump.-k
- Display the USB information with the specified kernel.-n
- Display the USB information with the specified numeric.-s
- Display the USB information with the specified slot.-t
- Display the USB information with the specified tree.-v
- Display the USB information with the specified verbose.
free
The free
command is used to display the memory information. It takes no arguments. The output of the free
command is the memory information.
free
Flags
-b
- Display the memory information with the specified bytes.-k
- Display the memory information with the specified kilobytes.-m
- Display the memory information with the specified megabytes.-g
- Display the memory information with the specified gigabytes.-h
- Display the memory information with the specified human-readable.-t
- Display the memory information with the specified total.-s
- Display the memory information with the specified seconds.-c
- Display the memory information with the specified continuous.-o
- Display the memory information with the specified omit header.-V
- Display the memory information with the specified version.
Configure and Troubleshoot Network
Network engineers fresh to the Linux environment can benefit from reading this section. I made an effort to include the most used network troubleshooting commands. Tcpdump, iperf, netperf, and several more networking tools are also available for debugging network-related problems, but because of their complexity, they are not included in this list.
ifconfig
The ifconfig
command is used to configure and display the network interface information. It takes no arguments. The output of the ifconfig
command is the network interface information.
ifconfig
Flags
-a
- Display the network interface information with the specified all.-s
- Display the network interface information with the specified summary.-v
- Display the network interface information with the specified verbose.-V
- Display the network interface information with the specified version.
ip
The ip
command is used to configure and display the network interface information. It takes no arguments. The output of the ip
command is the network interface information.
ip
Flags
-s
- Display the network interface information with the specified statistics.-d
- Display the network interface information with the specified details.-h
- Display the network interface information with the specified help.-v
- Display the network interface information with the specified verbose.-V
- Display the network interface information with the specified version.
netstat
The netstat
command is used to display the network information. It takes no arguments. The output of the netstat
command is the network information.
netstat
Flags
-a
- Display the network information with the specified all.-c
- Display the network information with the specified continuous.-e
- Display the network information with the specified extended.-g
- Display the network information with the specified multicast.-i
- Display the network information with the specified interfaces.-l
- Display the network information with the specified listening.-m
- Display the network information with the specified memory.-n
- Display the network information with the specified numeric.-p
- Display the network information with the specified protocol.-r
- Display the network information with the specified routing.
route
The route
command is used to display the routing information. It takes no arguments. The output of the route
command is the routing information.
route
Flags
-n
- Display the routing information with the specified numeric.-v
- Display the routing information with the specified verbose.-V
- Display the routing information with the specified version.
ethtool
The ethtool
command is used to display the network interface information. It takes no arguments. The output of the ethtool
command is the network interface information.
ethtool
Flags
-a
- Display the network interface information with the specified all.-i
- Display the network interface information with the specified interface.-k
- Display the network interface information with the specified kernel.-S
- Display the network interface information with the specified statistics.-c
- Display the network interface information with the specified command.-h
- Display the network interface information with the specified help.-V
- Display the network interface information with the specified version.
tcpdump
The tcpdump
command is used to capture and display the network packets. It takes no arguments. The output of the tcpdump
command is the network packets.
tcpdump
Flags
-c
- Capture and display the network packets with the specified count.-i
- Capture and display the network packets with the specified interface.-n
- Capture and display the network packets with the specified numeric.-r
- Capture and display the network packets with the specified read.-s
- Capture and display the network packets with the specified snapshot.-w
- Capture and display the network packets with the specified write.-A
- Capture and display the network packets with the specified ASCII.-C
- Capture and display the network packets with the specified file.-D
- Capture and display the network packets with the specified devices.-F
- Capture and display the network packets with the specified output.-G
- Capture and display the network packets with the specified rotate.-H
- Capture and display the network packets with the specified hex.-L
- Capture and display the network packets with the specified follow.-N
- Capture and display the network packets with the specified no.-S
- Capture and display the network packets with the specified size.-T
- Capture and display the network packets with the specified timestamp.-Z
- Capture and display the network packets with the specified user.-d
- Capture and display the network packets with the specified decode.-V
- Capture and display the network packets with the specified version.
ping
The ping
command is used to send the ICMP echo request packets to the specified host. It takes no arguments. The output of the ping
command is the ICMP echo reply packets.
ping
Flags
-c
- Send the ICMP echo request packets to the specified host with the specified count.-i
- Send the ICMP echo request packets to the specified host with the specified interval.-I
- Send the ICMP echo request packets to the specified host with the specified interface.-s
- Send the ICMP echo request packets to the specified host with the specified size.-t
- Send the ICMP echo request packets to the specified host with the specified ttl.-v
- Send the ICMP echo request packets to the specified host with the specified verbose.-V
- Send the ICMP echo request packets to the specified host with the specified version.
traceroute
The traceroute
command is used to trace the route to the specified host. It takes no arguments. The output of the traceroute
command is the route to the specified host.
traceroute
Flags
-d
- Trace the route to the specified host with the specified debug.-f
- Trace the route to the specified host with the specified first.-g
- Trace the route to the specified host with the specified gateway.-I
- Trace the route to the specified host with the specified interface.-m
- Trace the route to the specified host with the specified max.-n
- Trace the route to the specified host with the specified numeric.-p
- Trace the route to the specified host with the specified port.-q
- Trace the route to the specified host with the specified query.-s
- Trace the route to the specified host with the specified source.-t
- Trace the route to the specified host with the specified ttl.-v
- Trace the route to the specified host with the specified verbose.-V
- Trace the route to the specified host with the specified version.
dig
The dig
command is used to query the DNS name servers. It takes no arguments. The output of the dig
command is the DNS name servers.
dig
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
nslookup
The nslookup
command is used to query the DNS name servers. It takes no arguments. The output of the nslookup
command is the DNS name servers.
nslookup
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
host
The host
command is used to query the DNS name servers. It takes no arguments. The output of the host
command is the DNS name servers.
host
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
drill
The drill
command is used to query the DNS name servers. It takes no arguments. The output of the drill
command is the DNS name servers.
drill
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
ss
The ss
command is used to query the DNS name servers. It takes no arguments. The output of the ss
command is the DNS name servers.
ss
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
wget
The wget
command is used to query the DNS name servers. It takes no arguments. The output of the wget
command is the DNS name servers.
wget
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
curl
The curl
command is used to query the DNS name servers. It takes no arguments. The output of the curl
command is the DNS name servers.
curl
Flags
-a
- Query the DNS name servers with the specified all.-b
- Query the DNS name servers with the specified bind.-c
- Query the DNS name servers with the specified class.-d
- Query the DNS name servers with the specified debug.-f
- Query the DNS name servers with the specified file.-i
- Query the DNS name servers with the specified interface.-k
- Query the DNS name servers with the specified key.-m
- Query the DNS name servers with the specified max.-n
- Query the DNS name servers with the specified numeric.-p
- Query the DNS name servers with the specified port.-q
- Query the DNS name servers with the specified query.-r
- Query the DNS name servers with the specified recurse.-s
- Query the DNS name servers with the specified server.-t
- Query the DNS name servers with the specified type.-v
- Query the DNS name servers with the specified verbose.-V
- Query the DNS name servers with the specified version.
nmap
The nmap
command is used to query the DNS name servers. It takes no arguments. The output of the nmap
command is the DNS name servers.
nmap
Flags
-A
- Query the DNS name servers with the specified all.-V
- Query the DNS name servers with the specified version.
Manage System Processes
You may control Linux processes and troubleshoot any server resource-related issues with the use of these Linux commands. These commands let you keep an eye on your server’s RAM, CPU, disk IO, and other resources.
ps
The ps
command is used to list the processes running on the system. It takes no arguments. The output of the ps
command is the processes running on the system.
ps
Flags
-a
- List the processes running on the system with the specified all.-f
- List the processes running on the system with the specified full.-l
- List the processes running on the system with the specified long.-u
- List the processes running on the system with the specified user.
top
The top
command is used to display the processes running on the system. It takes no arguments. The output of the top
command is the processes running on the system.
top
Flags
-b
- Display the processes running on the system with the specified batch.-c
- Display the processes running on the system with the specified command.-d
- Display the processes running on the system with the specified delay.-h
- Display the processes running on the system with the specified help.-i
- Display the processes running on the system with the specified idle.-n
- Display the processes running on the system with the specified iterations.-p
- Display the processes running on the system with the specified pid.-s
- Display the processes running on the system with the specified sort.-u
- Display the processes running on the system with the specified user.-v
- Display the processes running on the system with the specified version.
kill
The kill
command is used to kill a process. It takes one argument. The output of the kill
command is the killed process.
kill
Flags
-l
- Kill a process with the specified list.
killall
The killall
command is used to kill a process. It takes one argument. The output of the killall
command is the killed process.
killall
Flags
-l
- Kill a process with the specified list.
pkill
The pkill
command is used to kill a process. It takes one argument. The output of the pkill
command is the killed process.
pkill
Flags
-l
- Kill a process with the specified list.
pgrep
The pgrep
command is used to kill a process. It takes one argument. The output of the pgrep
command is the killed process.
pgrep
Flags
-l
- Kill a process with the specified list.
nice
The nice
command is used to run a process with a nice value. It takes one argument. The output of the nice
command is the process with a nice value.
nice
Flags
-n
- Run a process with a nice value with the specified nice.-p
- Run a process with a nice value with the specified pid.-v
- Run a process with a nice value with the specified verbose.
renice
The renice
command is used to run a process with a nice value. It takes one argument. The output of the renice
command is the process with a nice value.
renice
Flags
-n
- Run a process with a nice value with the specified nice.-p
- Run a process with a nice value with the specified pid.-v
- Run a process with a nice value with the specified verbose.
at
The at
command is used to run a process at a specified time. It takes one argument. The output of the at
command is the process at a specified time.
at
Flags
-f
- Run a process at a specified time with the specified file.-q
- Run a process at a specified time with the specified queue.-r
- Run a process at a specified time with the specified remove.-v
- Run a process at a specified time with the specified verbose.
atq
The atq
command is used to run a process at a specified time. It takes one argument. The output of the atq
command is the process at a specified time.
atq
Flags
-c
- Run a process at a specified time with the specified clear.-q
- Run a process at a specified time with the specified queue.-v
- Run a process at a specified time with the specified verbose.
atrm
The atrm
command is used to run a process at a specified time. It takes one argument. The output of the atrm
command is the process at a specified time.
atrm
Flags
-v
- Run a process at a specified time with the specified verbose.
batch
The batch
command is used to run a process at a specified time. It takes one argument. The output of the batch
command is the process at a specified time.
batch
Flags
-f
- Run a process at a specified time with the specified file.-q
- Run a process at a specified time with the specified queue.-r
- Run a process at a specified time with the specified remove.-v
- Run a process at a specified time with the specified verbose.
crontab
The crontab
command is used to run a process at a specified time. It takes one argument. The output of the crontab
command is the process at a specified time.
crontab
Flags
-e
- Run a process at a specified time with the specified edit.-l
- Run a process at a specified time with the specified list.-r
- Run a process at a specified time with the specified remove.
iostat
The iostat
command is used to run a process at a specified time. It takes one argument. The output of the iostat
command is the process at a specified time.
iostat
Flags
-c
- Run a process at a specified time with the specified count.-d
- Run a process at a specified time with the specified device.-h
- Run a process at a specified time with the specified help.-k
- Run a process at a specified time with the specified kilobytes.-m
- Run a process at a specified time with the specified megabytes.-p
- Run a process at a specified time with the specified partition.-q
- Run a process at a specified time with the specified quiet.-t
- Run a process at a specified time with the specified time.-x
- Run a process at a specified time with the specified extended.-y
- Run a process at a specified time with the specified summary.
vmstat
The vmstat
command is used to run a process at a specified time. It takes one argument. The output of the vmstat
command is the process at a specified time.
vmstat
Flags
-a
- Run a process at a specified time with the specified all.-d
- Run a process at a specified time with the specified disk.-f
- Run a process at a specified time with the specified file.-h
- Run a process at a specified time with the specified help.-i
- Run a process at a specified time with the specified interrupt.
sar
The sar
command is used to run a process at a specified time. It takes one argument. The output of the sar
command is the process at a specified time.
sar
Flags
-A
- Run a process at a specified time with the specified all.-B
- Run a process at a specified time with the specified block.-b
- Run a process at a specified time with the specified boot.-d
- Run a process at a specified time with the specified device.-e
- Run a process at a specified time with the specified error.-f
- Run a process at a specified time with the specified file.-h
- Run a process at a specified time with the specified help.-H
- Run a process at a specified time with the specified huge.-I
- Run a process at a specified time with the specified interrupt.-j
- Run a process at a specified time with the specified job.-k
- Run a process at a specified time with the specified kernel.-l
- Run a process at a specified time with the specified lock.-m
- Run a process at a specified time with the specified memory.-n
- Run a process at a specified time with the specified network.-o
- Run a process at a specified time with the specified output.-p
- Run a process at a specified time with the specified partition.-q
- Run a process at a specified time with the specified queue.-r
- Run a process at a specified time with the specified remove.-R
- Run a process at a specified time with the specified reboot.-S
- Run a process at a specified time with the specified swap.-s
- Run a process at a specified time with the specified system.-t
- Run a process at a specified time with the specified time.-u
- Run a process at a specified time with the specified user.-v
- Run a process at a specified time with the specified version.-w
- Run a process at a specified time with the specified wait.-W
- Run a process at a specified time with the specified watchdog.-x
- Run a process at a specified time with the specified extended.-y
- Run a process at a specified time with the specified summary.
Summary
You learnt about Linux CLI commands in this tutorial, along with the fundamental commands for:
- File Management
- Finding files and directories
- Check User Information
- Managing Users and Groups
- Managing Permissions
- Check System Information
- Configure and Troubleshoot Network
- Manage System Processes