Linux Command Cheat Sheet: File, Directory, Process, Network, and System Management
This guide provides a concise reference of essential Linux commands for file and directory handling, file operations, permission management, searching, process control, networking, system monitoring, hardware information, log handling, text processing, and package management on both Debian‑based and RPM‑based distributions.
File and Directory Management
pwd – display the current directory.
ls [-l] – list directory contents; -l shows detailed information.
cd [directory] – change to the specified directory.
mkdir [-p] directory – create a directory; -p creates parent directories as needed.
rmdir directory – remove an empty directory.
rm [-rf] file_or_directory – delete files or directories; -r recursive, -f force.
File Operations
touch filename – create an empty file or update its timestamp.
cp source destination – copy files or directories.
mv source destination – move or rename files or directories.
cat filename – display the entire contents of a file.
head filename – show the beginning of a file.
tail [-n] filename – show the end of a file; -n specifies the number of lines.
less/more filename – view file contents page by page.
Permission Management
ls -l – view file and directory permissions.
chmod permissions file_or_directory – change permissions (e.g., chmod 755 file.txt ).
chown user:group file_or_directory – change ownership.
Search and Find
find [path] [criteria] – locate files (e.g., find . -name "test*.txt" ).
grep "keyword" filename or grep -r "keyword" directory – search file contents; -r recursive.
Process Management
ps aux – list currently running processes.
kill [signal] PID or pkill process_name – terminate processes.
pgrep process_name – find process IDs by name.
Network Related
ifconfig or ip addr show – display IP addresses.
ping target_address – test network connectivity.
netstat -tuln or ss -tuln – show listening ports.
System Information and Resource Monitoring
top or htop – view CPU and memory usage.
df -h – display disk space usage per partition.
du -sh * – show size of each file and directory in the current folder.
System and Hardware Information
uname -a – show kernel and system version.
uptime – display how long the system has been running.
lshw or dmidecode – detailed hardware information.
Log Viewing and Management
tail -f logfile – follow a log file in real time.
ls -lt – list files sorted by most recent modification.
Text Processing and Editing
sed -i 's/old/new/g' filename – replace text in a file in place.
awk – powerful column‑oriented text processing tool.
Package Management (Debian/Ubuntu)
apt-get install package_name – install a package.
apt-get update – refresh the package list.
apt-get upgrade – upgrade installed packages.
Package Management (RPM/CentOS)
yum install package_name – install a package.
yum check-update – check for available updates.
yum upgrade – upgrade installed packages.
Test Development Learning Exchange
Test Development Learning Exchange
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.