Beginner 2 min read

Linux Essential Commands

If you work with servers, cloud hosting, or backend development โ€” you will use these commands daily. No fluff, just the commands you actually need.


pwd          # Where am I right now?
ls           # What files are here?
ls -la       # Show all files including hidden ones
cd folder    # Go into a folder
cd ..        # Go back one level
cd ~         # Go to home directory

Files

touch file.txt        # Create empty file
cat file.txt          # Print file contents
nano file.txt         # Edit file (Ctrl+S save, Ctrl+X exit)
rm file.txt           # Delete file
cp file.txt copy.txt  # Copy file
mv old.txt new.txt    # Rename or move file

โš ๏ธ rm is permanent. There's no recycle bin in Linux.


Folders

mkdir myfolder      # Create folder
rm -r myfolder      # Delete folder and everything inside
cp -r folder copy   # Copy entire folder

find . -name "file.txt"    # Find file by name
grep "word" file.txt       # Find word inside file
grep -r "word" .           # Search word in all files

Permissions

whoami                  # Current logged-in user
chmod +x script.sh      # Make file executable
chmod 600 file.txt      # Only owner can read/write
sudo command            # Run as admin

System Info

top          # Live view of running processes (press Q to exit)
df -h        # Disk space usage
free -h      # RAM usage
uptime       # How long server has been running

Network

ping google.com     # Test internet connection
ip a                # Show your IP address
curl https://site   # Fetch a URL from terminal

Packages (Ubuntu/Debian)

sudo apt update                    # Refresh package list
sudo apt install package_name      # Install a package
sudo apt remove package_name       # Remove a package

Services

sudo systemctl start nginx      # Start a service
sudo systemctl stop nginx       # Stop a service
sudo systemctl restart nginx    # Restart a service
sudo systemctl status nginx     # Check if service is running

Keyboard Shortcuts

Shortcut What it does
Ctrl + C Stop running command
Ctrl + L Clear terminal screen
Tab Auto-complete file/folder name
โ†‘ arrow Repeat last command

Next Step

๐Ÿ‘‰ Connect to your server using SSH