Linux Command Cheatsheet

Category Command Description
File Navigation cd /path/to/dir Change directory
File Navigation ls -l List directory contents in long format
File Navigation pwd Print current directory
File Management cp src dest Copy files or directories
File Management mv src dest Move or rename files/directories
File Management rm file Remove a file
File Management mkdir dir Create new directory
File Management touch file Create new empty file
File Viewing cat file Display file contents
File Viewing less file View file page by page
File Viewing head file Show first 10 lines of file
File Viewing tail file Show last 10 lines of file
System Info uname -a Show system info
System Info top Show running processes
System Info df -h Show disk usage
System Info free -h Show memory usage
Package Management apt update Update package index (Debian/Ubuntu)
Package Management apt install pkg Install a package
Package Management yum install pkg Install a package (RHEL/CentOS)
User Management whoami Display current user
User Management sudo command Run command as root
User Management passwd Change user password
Networking ping host Send ICMP requests to host
Networking ifconfig Show IP configuration (deprecated)
Networking ip a Show IP addresses
Networking netstat -tuln Show listening ports
Permissions chmod 755 file Set permissions
Permissions chown user:group file Change file owner
Archives tar -czvf file.tar.gz dir/ Create gzip archive
Archives tar -xzvf file.tar.gz Extract gzip archive
Back to blog

Leave a comment