Linux commands
Linux commands
Page | 1
netstat Display network connections, routing tables, and interface
statistics.
ss Socket statistics (more advanced than netstat).
ifconfig / ip a Show network interfaces and their configuration.
curl <url> Transfer data from or to a server (works for HTTP, FTP, etc.).
wget <url> Download files from a URL.
System Monitoring top Display real-time system processes and resource usage.
htop Interactive, enhanced version of top (installable via apt install
htop).
ps aux Show all currently running processes on the system.
df -h Display disk space usage of filesystems in a human-readable
format.
du -sh <dir> Show the disk usage of a directory.
free -h Display system memory usage in a human-readable format.
Disk & File System fdisk -l List partition tables for storage devices.
mount <device> Mount a storage device to a directory.
<mount_point>
umount <mount_point> Unmount a storage device.
fsck <device> Check and repair a filesystem.
Process Management kill <pid> Terminate a process by its process ID.
killall <process_name> Terminate all instances of a process by name.
bg Move a job to the background.
fg Bring a job to the foreground.
nohup <command> Run a command immune to hangups (useful for long-running
processes).
Archiving & tar -cvf <archive.tar> <dir> Create a .tar archive from a directory.
Compression
Page | 2
tar -xvf <archive.tar> Extract a .tar archive.
gzip <file> Compress a file using gzip (creates .gz file).
gunzip <file.gz> Decompress a .gz file.
zip <file.zip> <file1> <file2>
Create a zip archive.
unzip <file.zip> Extract files from a zip archive.
System Updates apt-get update Update package lists for Ubuntu/Debian-based systems.
apt-get upgrade Upgrade installed packages for Ubuntu/Debian-based systems.
yum update Update packages for RHEL/CentOS-based systems.
dnf upgrade Upgrade packages for Fedora-based systems.
System Info uname -a Display detailed system information (kernel version, architecture,
etc.).
uptime Display the system uptime and load averages.
lscpu Show information about the CPU architecture.
lsblk List information about all available block devices (disks).
free -h Display memory usage in a human-readable format.
Search & Find find <path> -name <filename> Search for files by name.
locate <filename> Locate a file on the system using a pre-built index (faster than
find).
which <command> Find the location of an executable command.
Text Processing awk '{print $1}' <file> Process and print specific columns from a file.
sed 's/old/new/g' <file> Stream editor to replace text in a file.
cut -d' ' -f1 <file> Extract specific fields from a file.
Package Management dpkg -l List installed packages (Debian/Ubuntu).
rpm -qa List installed packages (RedHat/CentOS).
apt-get install <package> Install a package (Ubuntu/Debian).
yum install <package> Install a package (CentOS/RHEL).
Page | 3