Linux Commands List for DevOps
Being proficient in Linux commands is essential for any developer, sysadmin, or IT professional in
today’s fast-paced world of DevOps. I hope you will find all the necessary commands in this list that
will help you become more productive and efficient at work
File and Disk Management Commands
Here, I have included all commands that you will need for navigation through files and
directories, displaying contents, changing permissions, and extracting information about disks and
files.
COMMAND DESCRIPTION
ls Lists files and directories in current directory
Lists files and directories with information such as
ls -l permissions, ownership, size, and modification
date
ls -a Lists all files and directories including hidden ones
cat -b Inserts line numbers to non-blank lines
cat -n Inserts line numbers to all lines
Squeezes multiple blank lines into a single blank
cat -s
line while displaying the file contents
Displays contents of a file ending with a $ symbol
cat –E
in each line
chmod Changes permissions of a file or directory
chown Changes ownership of a file or directory
tail Displays last 10 lines of a specified file
dd Copies raw data from one file/ device to another
find Finds files and directories based on specific criteria
Copies securely files between hosts on a network
scp
using SSH (Secure Shell) protocol
df Estimates space used by entire file system
Displays the amount of disk space used by
du
individual file
User and Group Management Commands
You will find these commands useful for managing user accounts and groups. You will be able
to control access to files, directories, and other resources on the system. Also, some commands
allow you to verify user and group information, troubleshoot permissions issues, and manage user
and group access to resources on a system.
COMMAND DESCRIPTION
Creates a new user
sudo useradd <username> account with the
specified username
Changes the password
sudo passwd <username>
for the specified user
Deletes the specified
sudo userdel <username> user account from the
system.
Creates a new group
sudo groupadd <groupname> with the specified group
name
Deletes the specified
sudo groupdel <groupname>
group from the system
Modifies the primary
sudo usermod -g <groupname> group of the specified
<username> user to the specified
group
Displays the user ID (uid)
id and group ID (gid) of the
current user
Displays the group ID
id -g <groupname> (gid) of the specified
group
Displays the user ID (uid)
id -u <username>
of the specified user
Displays the user ID (uid),
group ID (gid), and
id <username> supplementary group IDs
(sgid) of the specified
user
System Monitoring Commands
As a DevOps professional, you will use these commands for troubleshooting issues related to file
access and identifying processes and files that are opened.
COMMAND DESCRIPTION
Lists all files opened by any process of a
lsof
system
lsof -u username Lists all files opened by a user
Text Searching Commands
In case of searching for a specific pattern in files, you may find this grep command a versatile one.
COMMAND DESCRIPTION
grep -i Performs a case-insensitive search
Displays the line numbers of the matched
grep -n
pattern
Inverts the search and displays all lines
grep -v
that do not match the pattern
Shows a count of the number of lines that
grep -c
match the pattern
Network Configuration and Monitoring Commands
You are going to need these commands to troubleshoot network-related issues and gather
information about the configuration of a system.
COMMAND DESCRIPTION
ifconfig Displays network interface configuration
information, such as IP address, netmask,
and broadcast address
Displays all interface available even if
ifconfig -a
those are down
ifconfig -s Displays short list of network interface
Displays and manages routing, devices,
ip
and tunnels
Displays all IP addresses related with all
ip address
network devices
Shows all network interfaces available on
ip link
the system
Queries the DNS server for information
nslookup
about a domain name or IP address
Facilitates the transfer of data to or from a
server, using any of the protocols it
curl
supports, such as HTTP, HTTPS, FTP, FTPS,
SCP, SFTP, TFTP, DICT, TELNET, LDAP, or FILE
Client-server protocol used to establish a
telnet
connection to a remote computer
Displays network connections and
network statistics, such as active sockets,
netstat
routing tables, and network interface
statistics
Creates a pair of public and private
ss-keygen
authentication keys
route Access the Linux kernel’s routing tables
Scans hosts and services on a network,
and provides information about operating
nmap
systems, open ports, and services running
on the hosts
Sets up, maintains, and inspects the tables
iptables of IPv4/IPv6 packet filter rules in the Linux
kernel firewall
System Information Commands
I have listed some commands in this section that you will need to manage and maintain computer
systems and software development.
COMMAND DESCRIPTION
unmae -o Displays the operating system name
uname -m Displays the machine hardware name
uname -r Displays the kernel release number
lshw Lists hardware information of the system.
lscpu Displays information about the CPU
Displays the list of previously executed
history
commands
Displays the amount of free and used
free
memory in the system
Text Manipulation Commands
Suppose you want to manage a large amount of data and want to automate tasks in a DevOps
environment. Then you should learn these commands for file manipulation and organization.
COMMAND DESCRIPTION
sort -r Sorts the output in reverse order
sort -f Sorts the output ignoring the case
sort -n Sorts the output numerically.
Extracts specific portion from a file or
cut
input stream
diff Compares two files and displays the
differences between them
sed Editor used for modifying text
Translates or deletes characters from
tr standard input and writes to standard
output
uniq Filters out duplicate lines in a file
Process Management Commands
To manage processes in real-time and list out running packages, you can learn commands given
below.
COMMAND DESCRIPTION
Interactive process viewer that displays
htop
system resource usage in real-time
Lists information about currently running
ps
processes
kill Sends a signal to a process to terminate it
Package Management Commands
If you want to install, search or remove a package in your system, these commands can be very
useful.
COMMAND DESCRIPTION
Handles packages on Ubuntu-based
apt -get
systems
Searches for packages matching a given
apt search
package name
sudo apt-get remove Removes a package from the system
Miscellaneous Commands
In this section, I am going to discuss some miscellaneous commands as well as some commands that
can be used to manage docker containers.
COMMAND DESCRIPTION
Retrieves entries from databases, such as the user and
getent group database or the Domain Name System (DNS)
database
docker ps Lists all active Docker containers
docker
Lists all Docker images on user’s machine
images
docker
Builds a Docker image from a Dockerfile
build
docker run Runs a Docker container
docker stop Stops an active Docker container
docker-
Starts containers defined in a docker-compose.yml file
compose up
docker-
Stops and removes containers defined in a docker-
compose
compose.yml file
down
Git Commands
You must keep all of your communication in Version Control if you want to be successful with
DevOps. Here comes the role of Git, an open-source distributed version control system. Here, I have
discussed the git commands that you will find essential.
COMMAND DESCRIPTION
git init Initializes a new and empty Git repository.
Creates a copy of a Git repository in a new
git clone
directory from an existing URL
Adds changes to the staging area in
git add preparation for committing them to the
repository
git commit Records changes to the repository with a
message describing the changes
Shows the current status of the repository,
git status including any changes that have been made
but not yet committed
Displays information about a specific
git show
commit or object
Removes files from the repository and
git rm
stages the deletion
Connects remote server with the local
git remote
repository
Sends committed changes to a remote
git push
repository
Fetches changes from a remote repository
git pull
and merges them into the local repository
Lists, creates, or deletes branches within
git branch
the repository
Switches between different branches or
git checkout
creates a branch and switches to it
Combines specified branch’s history into the
git merge
current one
Moves all work from the current to the
git rebase
master branch