CheatSheet - Linux Devops Commands Cheat Sheet by Linuxsimply
CheatSheet - Linux Devops Commands Cheat Sheet by Linuxsimply
For DevOps
File and Disk Management User and Group Management
sudo useradd Creates a new user account with the
ls Lists files and directories in current directory
<username> specified username
Lists files and directories with information
sudo passwd Changes the password for the specified
ls -l such as permissions, ownership, size, and
<username> user
modification date
Lists all files and directories including hidden sudo userdel Deletes the specified user account from
ls -a
ones <username> the system
sudo groupadd Creates a new group with the specified
cat -b Inserts line numbers to non-blank lines
<groupname> group name
sudo groupdel Deletes the specified group from the
cat -n Inserts line numbers to all lines
<groupname> system
sudo usermod -g
Squeezes multiple blank lines into a single Modifies the primary group of the
cat -s <groupname>
blank line while displaying the file contents specified user to the specified group
<username>
Displays contents of a file ending with a $ Displays the user ID (uid) and group ID
cat –E id
symbol in each line (gid) of the current user
id -g Displays the group ID (gid) of the
chmod Changes permissions of a file or directory
<groupname> specified group
id -u Displays the user ID (uid) of the specified
chown Changes ownership of a file or directory
<username> user
Displays the user ID (uid), group ID (gid),
Copies raw data from one file/ device to
dd id <username> and supplementary group IDs (sgid) of
another
specified user
tail Displays last 10 lines of a specified file Text Manipulation
Finds files and directories based on specific
find sort -r Sorts the output in reverse order
criteria
Copies securely files between hosts on a
scp sort -f Sorts the output ignoring the case
network using SSH (Secure Shell) protocol
df Estimates space used by entire file system sort -n Sorts the output numerically
Displays the amount of disk space used by Extracts specific portion from a file or
du cut
individual file input stream
Compares two files and displays the
Process Management diff
differences between them
Translates or deletes characters from
Interactive process viewer that displays
htop tr standard input and writes to standard
system resource usage in real-time
output
Lists information about currently running
ps sed Editor used for modifying text
processes
kill Sends a signal to a process to terminate it uniq Filters out duplicate lines in a file
Displays the list of previously executed
history
commands System Information
Displays the amount of free and used memory
free unmae -o Displays the operating system name
in the system
uname -m Displays the machine hardware name
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
For DevOps
Package Management uname -r Displays the kernel release number
apt -get Handles packages on Ubuntu-based systems lscpu Displays information about the CPU
sudo apt-get
remove
Removes a package from the system Text Searching
Network Configuration & Monitoring grep -i Performs a case-insensitive search
Displays network interface configuration
Displays the line numbers of the
ifconfig information, such as IP address, netmask, and grep -n
matched pattern
broadcast address
Displays all interface available even if those Inverts the search and displays all lines
ifconfig -a grep -v
are down that do not match the pattern
Shows a count of the number of lines
ifconfig -s Displays short list of network interface grep -c
that match the pattern
Displays and manages routing, devices, and
ip
tunnels System Monitoring
Displays all IP addresses related with all Lists all files opened by any process of a
ip address lsof
network devices system
Shows all network interfaces available on the
ip link lsof -u username Lists all files opened by a user
system
Queries the DNS server for information about
nslookup
a domain name or IP address Miscellaneous
route Access the Linux kernel's routing tables docker ps Lists all active Docker containers
Sets up, maintains, and inspects the tables of
Lists all Docker images on user’s
iptables IPv4/IPv6 packet filter rules in the Linux kernel docker images
machine
firewall
Displays network connections and network
Builds a Docker image from a
netstat statistics, such as active sockets, routing docker build
Dockerfile
tables, and network interface statistics
Creates a pair of public and private
ss-keygen docker run Runs a Docker container
authentication keys
Client-server protocol used to establish a
telnet docker stop Stops an active Docker container
connection to a remote computer
Scans hosts and services on a network, and
docker- Starts containers defined in a docker-
nmap provides information about operating systems,
compose up compose.yml file
open ports, and services running on the hosts
Facilitates the transfer of data to or from a
server, using any of the protocols it supports, docker- Stops and removes containers
curl
such as HTTP, HTTPS, FTP, FTPS, SCP, SFTP, compose down defined in a docker-compose.yml file
TFTP, DICT, TELNET, LDAP, or FILE
Retrieves entries from databases,
such as the user and group database
getent
or the Domain Name System (DNS)
database
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
For DevOps
Git Commands
git init Initializes a new and empty Git repository
Creates a copy of a Git repository in a new directory from
git clone
an existing URL
Adds changes to the staging area in preparation for
git add
committing them to the repository
git rm Removes files from the repository and stages the deletion
git merge Combines specified branch’s history into the current one
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.