Linux Basics
Core Areas for Sysadmin and DevOps
- filesystem and permissions
- processes and systemd
- networking and diagnostics
- package managers
- logs and journald
- shell automation
Files and Directories
pwd
ls -lah
tree
cd /path
cp -r src dst
mv old new
rm -rf tmp/
find /etc -name '*.conf'
du -sh *
df -h
Permissions and Ownership
Classic permission model:
rreadwwritexexecute
Processes
systemd
systemctl status nginx
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl enable nginx
systemctl disable nginx
systemctl daemon-reload
journalctl -u nginx -xe
journalctl -f
Users and sudo
Archives and Transfers
tar -czf backup.tar.gz /etc
tar -xzf backup.tar.gz
scp file user@host:/tmp/
rsync -avz ./app/ user@host:/srv/app/
curl -I https://example.com
wget https://example.com/file.tar.gz
Package Managers
Debian/Ubuntu
RHEL/Rocky/Alma
Logs and Diagnostics
Bash and Pipes
cat file | grep nginx
grep -R "server_name" /etc/nginx
awk '{print $1}' file
sed -n '1,20p' file
cut -d: -f1 /etc/passwd
sort file | uniq
xargs -I{} echo {}
Practice
- Prefer
ip,ss,journalctl, andsystemctlover older tools such asifconfig,netstat, andservicewhen the distro uses a modern userspace. - Use
rm -rfandkill -9as a last resort, not as a default habit. - If an action is repeated, write a script, role, or automation job early.