Dev_Zeeshan
Linux
Commands
for DevOps
Beginner Advance
All the listed linux
commands based
these concepts
User Management
File Management
Network Management
System and Package Mangement
Basic Linux Commands
LINUX COMMANDS MEANING USAGE
cd Changes the current working directory cd /path/to/directory
pwd Prints the current working directory pwd
mkdir Creates a new directory mkdir directory_name
touch Creates empty files touch file_name
cat Print the content of a file cat file_name
ls Shows basic file and directory names. ls
Basic Linux Commands
LINUX COMMANDS MEANING USAGE
Lists files and directories with detailed
ls -l ls -l
information
mv [file name] [file name] Renames a file mv 1.txt 2.txt
mv [file name] [path] Move a file mv 2.txt /home/Desktop
rm Removes files rm file_name
rmdir Removes empty directories rmdir directory_name
cd .. Moves up one directory level cd ..
LINUX COMMANDS MEANING USAGE
Displays a real-time list of running
top top
processes
Recursively removes the directory
rm -r directory_name rm -r learnlinux
named "learnlinux" and its contents
echo "Linux" Prints the text "Linux" to the terminal echo “Linux”
Prints "Linux Learn" to a file named 1.txt. If
echo "Linux Learn" > filename echo "Linux Learn" > 1.txt
the file exists, it will be overwritten
Prints "Linux Learn" to a file named 2.txt. If
echo "Linux Learn" > filename echo “Linux Learn” > 2.txt
the file not exists, it create one
Uncompresses and displays the zcat compressed_file.gz
zcat
contents of a compressed file
LINUX COMMANDS MEANING USAGE
head Displays the first few lines of a file head file_name
tail Displays the last few lines of a file tail file_name
Continuously monitors a file for new
tail -f tail -f file_name
content and displays it as it's added
View and navigate through the content
less less file_name
of a file interactively
Display the content of a file one screen
more more file_name
at a time
To get more information about a specific
man man command_name
command
LINUX COMMANDS MEANING USAGE
cp source_file
cp Copies files
destination_file
Copies directories recursively (including cp -r source_directory
cp -r
all subdirectories and files) destination_directory
Counts words, lines, and characters in
wc wc file_name
files
A hard link always points a filename to ln [original_file]
Hard link
data on a storage device [new_hard_link]
A soft link always points a filename to
ln -s [original_file]
Soft link another filename, which then points to
[new_soft_link]
information on a storage device
LINUX COMMANDS MEANING USAGE
Extracts the first byte (character) from each
cut -b cut -b file_name
line of the file
Reads from standard input and writes to
echo "Hello, world!" | tee
both standard output and one or more
tee output.txt
files. Useful for simultaneously viewing
and saving output
Sorts lines of text alphabetically or
sort sort file_name
numerically
clear Clears the terminal screen clear
Compares two files line by line and
diff diff file1 file2
highlights differences
LINUX COMMANDS MEANING USAGE
Displays free and used memory in the
free free / free -h
system
Secure Shell, used for remote login and
ssh ssh user@host
command execution
df Displays disk usage information df
Shows disk usage for the current
du . du .
directory and its subdirectories
ps Lists running processes ps
Shows which processes are using a
fuser fuser file_name
specific file or socket
LINUX COMMANDS MEANING USAGE
kill Sends a signal to a process kill -SIGHUP [process_id]
Terminate a Process (Soft Kill - kill [process_id]
kill
SIGTERM)
Forcefully Terminate a Process (Hard Kill
kill kill -SIGKILL [process_id]
- SIGKILL)
kill Send a Different Signal using signal no. kill -1 [process_id]
kill Kill all Processes with a Specific Name pkill myprocess
Display and modify the environment
env env
variables for a shell session
LINUX COMMANDS MEANING USAGE
Prints system information, including the
uname uname
kernel name, version, and architecture
Shows how long the system has been
uptime uptime
running
who Lists currently logged-in users who
whoami Prints the name of the current user whoami
Locates a command's executable file
which which ls / which bash
path
Prints user and group ID information for
id id
the current user
LINUX COMMANDS MEANING USAGE
Executes a command with elevated
sudo privileges (as the root user)as it grants full sudo
system access
Displays the contents of the
/etc/passwd file, which stores user
cat /etc/passwd account information, including cat /etc/passwd
usernames, user IDs, home directories,
and default shells
sudo shutdown Shuts down the system immediately sudo shutdown
sudo reboot Prints the name of the current user sudo reboot
It allows you to install, update, upgrade, apt upgrade/
apt and remove software packages on your apt show/
system apt serach, etc
LINUX COMMANDS MEANING USAGE
Installs the package using the apt package
sudo apt install package_name sudo apt install git
manager
sudo apt remove package_name Removes the package sudo apt remove git
Creates a new user named "dev_shan" sudo useradd -m
sudo useradd -m newuser
and creates a home directory for them. dev_shan
Sets or changes the password for the
sudo passwd newuser sudo passwd dev_shan
user "dev_shan"
Switches the current user to
su oldUser su dev_zeeshan
"dev_zeeshan"
sudo userdel newser Deletes the user account "dev_shan" sudo userdel dev_shan
LINUX COMMANDS MEANING USAGE
sudo groupadd group_name Creates a new group named "devops" sudo groupadd devops
Adds the user "dev_zeehsna" to the sudo gpasswd -a
sudo gpasswd -a user1 group1
group "devops" dev_zeeshan devops
sudo useradd -M
sudo gpasswd -M user1 user2
Adds multiple users to the group dev_shan, dev_harsh
user3 user4 groupname
devops
Displays the contents of the /etc/group
file, which stores group information,
cat /etc/group cat/etc/devops
including group names, group IDs, and
member lists
It is used to set default permissions for
umask umask
files or directories the user creates
LINUX COMMANDS MEANING USAGE
Changes the permissions of the
specified folder to allow read, write, and
chmod 777 directory_name chmod 777 learnlinux
execute access for all users (owner,
group, and others).
Changes the owner of the file "1.txt" to
sudo chown user_name file_name sudo chown user1 1.txt
"user1"
sudo chgrp owner-name Changes the group ownership of the file
sudo chgrp zeeshan 1.txt
file_name "1.txt" to "zeeshan”
Creates a zip archive named "ldf.zip"
zip -r archive.zip directory_name containing the specified folder and its zip -r ldf.zip learnlinux
contents, including subdirectories
Extracts the contents of the zip archive
unzip archive.zip unzip ldf.zip
"ldf.zip".
LINUX COMMANDS MEANING USAGE
Used for creating and extracting tar
tar/untar archives, a common format for file
compression and distribution in Linux
tar -cvf archive.tar tar -cvf archive.tar
Creates a tar archive named "archive.tar"
[files/directories] learnlinux
Extracts the contents of the tar archive
tar -xvf archive.tar tar -xvf archive.tar"
"archive.tar"
it is used to check the network
ping [url] connectivity between host and ping google.com
server/host
Displays network connections and
netstat/ss netstat
statistics
LINUX COMMANDS MEANING USAGE
Manages and configures network
ifconfig ifconfig
interfaces
Traces the path of packets to
traceroute [url] traceroute youtube.com
youtube.com, showing hops and delays
Similar to traceroute, but with slightly
tracepath [url] tracerpath youtube.com
different output
Combines traceroute and ping,
mtr [url] providing continuous updates for mtr youtube.com
monitoring network paths
Queries DNS servers to resolve domain
nslookup [url] nslookup youtube.com
names to IP addresses
hostname Prints or sets the system's hostname hostname
LINUX COMMANDS MEANING USAGE
Displays IP addresses and other network
ip addr show ip addr show
interface information
iwconfig Configures wireless network interfaces iwconfig
Performs DNS lookups, often for
dig dig
troubleshooting DNS issues
WHOIS databases for domain name and
whois whois
IP address ownership information
nc [options] [hostname] [port[s]] A versatile tool for network
nc -v localhost 1234
communication and data transfer
Displays or manipulates the Address
arp arp
Resolution Protocol (ARP) cache
LINUX COMMANDS MEANING USAGE
Shows the status of network interfaces
ifplugstatus ifplugstatus
(plugged or unplugged)
A command-line JSON processor for
jq
parsing and manipulating JSON data
Fetches data from an API endpoint using curl -X GET apiendpoint |
curl -X GET apiendpoint | jq
curl and pipes it to jq for JSON parsing jq
wget link Downloads files from the web wget link
Tools to scans a network or host for open
nmap -v url nmap -v google.com
ports and services
Resources:
Linux Cheatsheet:
https://cheatography.com/davechild/cheat-
sheets/linux-command-line/
Linux for DevOps:
https://cheatography.com/davechild/cheat-
sheets/linux-command-line/
Linux Tutorial:
https://cheatography.com/davechild/cheat-
sheets/linux-command-line/
Thank you
Let’s Connect