Linux Commands Cheat Sheet for Beginners, a concise, copy ready list of the most useful Linux terminal commands with examples, flags, and safety tips. Use it to navigate directories, manage files, control services, monitor resources, handle networking, and automate tasks, whether you’re on a local machine or managing a server over SSH.
If you’re new to the Linux command line, this beginner friendly cheat sheet gives you the basic Linux commands you’ll use every day. I’ve organized it by tasks so you can find what you need fast, plus practical examples from real server work. It’s ideal for local Linux desktops and SSH sessions on VPS or cloud hosting.
As a Senior Technical SEO Content Writer at YouStable, I’ve spent over a decade configuring servers, hardening security, and troubleshooting production issues. Below is the streamlined, no fluff reference I wish I had when I started.
What is the Linux Command Line?
The Linux command line (terminal or shell) is a text based interface to control the operating system. It’s faster and more precise than GUIs, especially for servers. Commands include a program name, optional options/flags, and arguments. Example: ls -lah /var/www lists files in a directory with details and human readable sizes.
How to Use This Linux Commands Cheat Sheet
- Copy any example, paste in your terminal, then modify paths or filenames.
- Run with
--helpto discover more options (e.g.,grep --help). - Use
man<command>for full manuals (e.g.,man tar). - When on a server (e.g., YouStable VPS), connect via SSH first:
ssh user@server-ip.
Navigation and File Management Commands
Navigation
# Show current directory
pwd
# List files (long, all, human-size)
ls -lah
# Change directory
cd /path/to/dir
cd ~ # to home
cd - # to previous directory
Create, Copy, Move, Delete
# Create file and directory
touch file.txt
mkdir new_folder
mkdir -p parent/child/grandchild # create nested dirs
# Copy files and directories
cp source.txt dest.txt
cp -r dir1 dir1_backup
# Move/rename
mv oldname.txt newname.txt
mv file.txt /another/path/
# Delete files and directories (CAUTION)
rm file.txt
rm -i file.txt # prompt before delete
rm -r folder # recursive delete
rm -rf folder # force delete (dangerous; double-check path!)
File Inspection
# Quick view
cat file.txt
# Paginated view (q to quit)
less file.txt
# First/last lines
head -n 20 file.txt
tail -n 50 file.txt
tail -f /var/log/syslog # follow live logs
Viewing, Searching, and Editing Files
Search and Find
# Search inside files (case-insensitive)
grep -i "error" /var/log/nginx/access.log
# Recursive search in directory
grep -R "TODO" src/
# Find files by name/size/type
find /var/www -name "*.php"
find . -type f -size +100M
find . -type d -name "cache"
Edit Text Files
On servers, a terminal editor is essential. nano is beginner friendly; vim is powerful but steeper to learn.
# Nano (save: Ctrl+O, exit: Ctrl+X)
nano /etc/nginx/nginx.conf
# Vim (enter insert mode: i, save/quit: :wq)
vim /etc/ssh/sshd_config
Permissions and Ownership
Linux permissions control who can read, write, or execute files. Ownership is per user and group. Misconfigured permissions are a common cause of web app errors.
chmod (Change Permissions)
# Numeric mode: rwx = 7, rw- = 6, r-x = 5, r-- = 4
chmod 644 file.txt # owner read/write, group+others read
chmod 755 script.sh # owner rwx, group+others rx
# Symbolic mode
chmod u+x deploy.sh # add execute to user (owner)
chmod -R g+w storage # recursively add write for group
chown and chgrp (Change Ownership)
# Change owner
sudo chown user file.txt
# Change owner and group (recursive)
sudo chown -R www-data:www-data /var/www/site
# Change group only
sudo chgrp developers repo/
Web servers (e.g., nginx, Apache) often run as www-data or apache. Ensure writable cache/uploads directories for your CMS while keeping code read only.
System Information and Monitoring
System and Hardware
uname -a # kernel and system info
lsb_release -a # distro info (Debian/Ubuntu)
cat /etc/os-release # distro info (universal)
uptime # system load and uptime
free -h # memory usage
df -h # disk usage by filesystem
du -sh * # disk usage in current dir (summaries)
Processes
ps aux | grep nginx # list processes matching a name
top # live system monitor (q to quit)
htop # improved top (install if missing)
kill <PID> # terminate process by PID
pkill -f "python app.py" # kill by name/pattern
Networking and Remote Access
Network Basics
ip a # show IP addresses
ping -c 4 8.8.8.8 # test connectivity
traceroute google.com # path to host (install if missing)
ss -tulpen # listening ports and sockets
curl -I https://domain.com # fetch HTTP headers
wget https://example.com/file.zip # download file
SSH, SCP, and SFTP
For servers (including YouStable VPS and Cloud plans), SSH is the secure way to connect and manage services.
# Connect to a server
ssh user@server-ip
# Use a specific key
ssh -i ~/.ssh/id_ed25519 user@server-ip
# Copy files to server (local to remote)
scp file.zip user@server-ip:/var/www/
# Copy directory recursively
scp -r site/ user@server-ip:/var/www/site/
# Interactive file transfer
sftp user@server-ip
Package Management and Updates
Debian/Ubuntu (apt)
sudo apt update
sudo apt upgrade -y
sudo apt install nginx
sudo apt remove package-name
apt show package-name
RHEL/CentOS/Rocky (dnf or yum)
sudo dnf update -y # or: sudo yum update -y
sudo dnf install nginx
sudo dnf remove package-name
dnf info package-name
Services and Logs
systemctl and service
# Start/stop/restart services
sudo systemctl status nginx
sudo systemctl restart nginx
sudo systemctl enable nginx # start on boot
# Older distros:
sudo service nginx status
Logs and Troubleshooting
journalctl -u nginx --since "1 hour ago"
journalctl -xe # recent critical logs
tail -f /var/log/nginx/error.log
tail -f /var/log/syslog # Debian/Ubuntu
tail -f /var/log/messages # RHEL/CentOS
Archives and Compression
# Create tar.gz archive
tar -czf site.tar.gz /var/www/site
# Extract tar.gz archive
tar -xzf site.tar.gz -C /target/dir
# Zip/unzip
zip -r backup.zip /path/to/dir
unzip backup.zip -d /restore/path
Redirection, Pipes, Wildcards, and Shortcuts
Redirection and Pipes
# Send output to a file (overwrite or append)
ls -lah > listing.txt
echo "new line" >> listing.txt
# Pipe output into another command
ps aux | grep nginx
du -sh * | sort -h
Wildcards and Brace Expansion
rm *.log # all .log files
mv image_{1..5}.png assets/ # expands to image_1.png ... image_5.png
cp site.{conf,bak} # copies site.conf to site.bak
Command History and Keyboard Shortcuts
- Up/Down: browse history
- Ctrl+C: cancel current command
- Ctrl+A / Ctrl+E: jump to start/end of line
- Tab: auto complete file/command names
- history | grep <term>: find past commands
Practical Scenarios for Beginners
1) Connect to a VPS and check disk space
ssh user@server-ip
df -h
du -sh /var/www/* | sort -h
2) Deploy a static site to /var/www/html
scp -r site/ user@server-ip:/var/www/html/
sudo chown -R www-data:www-data /var/www/html
sudo systemctl reload nginx
3) Find and kill a stuck process
ps aux | grep "python app.py"
kill <PID> # or: pkill -f "python app.py"
4) Backup and restore a project
# Backup
tar -czf project_$(date +%F).tar.gz /var/www/project
# Restore
tar -xzf project_2026-01-01.tar.gz -C /var/www/
If you host with YouStable, you can use these exact commands on our VPS, Dedicated, or Cloud plans. We provide SSD storage, SSH access, firewalls, snapshots, and 24×7 experts to help you stay productive and safe.
Quick Safety and Productivity Tips
- Always double check paths before running
rm -rf. - Use
sudosparingly; prefer least privilege. - Version control configuration files (e.g.,
/etc/nginx/) before big changes. - Keep systems updated:
sudo apt update && sudo apt upgrade -yorsudo dnf update -y. - Create regular backups and test restores.
- For web servers, watch logs while testing:
tail -f /var/log/nginx/error.log.
FAQ’s
1. What are the most essential Linux terminal commands?
Start with pwd, ls, cd, cp, mv, rm, mkdir, touch, cat, less, grep, find, chmod, chown, df, du, ps, top, curl, wget, ssh, scp, and your distro’s package manager (apt or dnf).
2. How do I learn Linux commands fast?
Practice daily on real tasks. Use this cheat sheet, run <command> --help, read man pages, and perform small projects (e.g., deploy a test site). If you have a YouStable VPS, experiment in a non production user account and snapshot the server before changes.
3. What is the safest way to remove files and directories?
Use rm -i to prompt before deletion and verify paths with pwd and ls. Avoid sudo rm -rf / patterns. When unsure, back up or move files to a trash/ directory before permanent deletion.
4. Which package manager should I use on Linux?
Debian/Ubuntu use apt. RHEL, CentOS, Rocky, and AlmaLinux use dnf (or yum on older versions). Use snap or flatpak for sandboxed desktop apps, but stick to your distro’s native manager for servers.
5. How do I check which process is using a port?
Run sudo ss -tulpen | grep :80 (replace 80 with your port). It shows the service and PID bound to that port. Then manage it with systemctl or terminate with kill/pkill.
This Linux Commands Cheat Sheet for Beginners is your starting point. Bookmark it, practice commands in a safe environment, and scale up to scripting and automation. If you need reliable infrastructure to learn or run production workloads, YouStable’s hosting lineup gives you the secure, SSH ready foundation you need.