0% found this document useful (0 votes)
53 views2 pages

Linux Commands CheatSheet

Uploaded by

testshare128
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views2 pages

Linux Commands CheatSheet

Uploaded by

testshare128
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux Commands Cheat Sheet

System Info
uname -a # Show system information
hostnamectl # Show hostname and OS details
uptime # Show system uptime
free -h # Show memory usage
df -h # Show disk space usage
du -sh * # Show folder sizes in current directory
top # Show running processes
htop # Better process viewer (if installed)

User Management
whoami # Show current logged-in user
who # Show who is logged in
id # Show your UID, GID, and groups
cat /etc/passwd # Show all users
sudo adduser USERNAME # Create new user
sudo deluser USERNAME # Delete a user

File & Directory


pwd # Show current directory
ls # List files
ls -l # List with details
ls -a # List all files (including hidden)
cd /path # Change directory
mkdir folder # Create folder
rmdir folder # Remove empty folder
rm -r folder # Remove folder with contents
cp file1 file2 # Copy file
mv old new # Move or rename file
touch file # Create empty file
cat file # Show file content
nano file # Edit file in nano editor
vim file # Edit file in vim editor

Search & Find


find /path -name filename # Find file by name
grep "text" file # Search text inside file
grep -r "text" /path # Search text in files recursively

Network
ping google.com # Test connectivity
curl ifconfig.me # Show public IP
ip a # Show IP addresses
netstat -tulnp # Show listening ports (if installed)
ss -tulnp # Modern replacement for netstat

Package Management (Debian/Ubuntu)


sudo apt update
sudo apt upgrade
sudo apt install package_name
sudo apt remove package_name

Package Management (RHEL/CentOS/Fedora)


sudo yum update
sudo yum install package_name
sudo yum remove package_name

Permissions
chmod 755 file # Change file permissions
chown user:group file # Change file owner

Archive & Compress


tar -czvf file.tar.gz folder # Compress folder
tar -xzvf file.tar.gz # Extract tar.gz file
zip -r file.zip folder # Create zip file
unzip file.zip # Extract zip file

You might also like