Beginner-friendly Linux notes, commands, troubleshooting tips, and practical DevOps context.
Most servers, cloud virtual machines, containers, and DevOps tools run on Linux. Learning the command line makes it easier to manage systems, investigate problems, and automate work.
| Command | What it does |
|---|---|
pwd |
Shows your current location. |
ls -la |
Lists files and permissions. |
cd /path/to/folder |
Moves to a folder. |
mkdir project |
Creates a folder. |
touch notes.txt |
Creates an empty file. |
cp file.txt copy.txt |
Copies a file. |
mv old.txt new.txt |
Moves or renames a file. |
find . -name "*.log" |
Finds log files. |
rm file.txt |
Deletes a file. Use carefully. |
cat file.txt # print a small file
less /var/log/syslog # view a large file; press q to exit
head -n 10 file.txt # first 10 lines
tail -n 20 file.txt # last 20 lines
tail -f app.log # follow a log as it changes
nano file.txt # simple terminal editor
grep -n "error" app.log # find error linesLinux controls who can read, write, or run files.
ls -l file.txt # view permissions and owner
chmod +x script.sh # allow a script to run
chmod 644 file.txt # owner can write; others can read
sudo chown user:group file.txt # change owner and groupsudo runs a command with administrator privileges. Use it only when needed and double-check commands before pressing Enter.
ps aux # list running processes
top # live view of CPU and memory use
kill PID # ask a process to stop
systemctl status nginx # check a service
sudo systemctl start nginx
sudo systemctl restart nginx
sudo systemctl enable nginx # start after rebootdf -h # free disk space
du -sh * # folder sizes in current directory
free -h # memory usage
uptime # uptime and load average
ip addr # network addresses
ping -c 4 example.com # basic connectivity test
curl -I https://example.com # check an HTTP response
ss -tulpn # listening portsOn Ubuntu and Debian systems:
sudo apt update
sudo apt install nginx
sudo apt remove nginxOn Red Hat, Fedora, and Amazon Linux systems, use dnf (or sometimes yum) instead of apt.
When something fails, start with the error message and recent logs.
sudo journalctl -u nginx --since "30 minutes ago"
sudo journalctl -xe
tail -n 50 /var/log/syslogSimple troubleshooting flow:
- Check the service:
systemctl status service-name - Read its recent logs:
journalctl -u service-name - Check disk and memory:
df -handfree -h - Check ports and network access:
ss -tulpnandcurl - Make one change at a time, then test again.
find /var/log -type f -size +100M 2>/dev/nullcurl -s -o /dev/null -w "%{http_code}\n" https://example.comscp backup.tar.gz user@server.example:/home/user/backups/- Run
pwdandlsbefore changing or deleting files. - Prefer
rm -i file.txtwhen learning; it asks for confirmation. - Keep system updates current, especially on test machines.
- Avoid logging in as
rootfor daily work; use a normal user withsudo. - Read logs before restarting services, so useful error information is not lost.
- Store configuration in version control, but never commit passwords or private keys.
- Document changes made to servers and deployment environments.
Linux skills are used every day for cloud servers, Docker containers, CI/CD runners, monitoring, incident response, and application deployments.
The goal is not to memorise every command—learn how to inspect a system, understand what you see, and make safe changes.