Make sure you understand basic Linux commands and their options, e.g., ls -larth.
Directory and File Navigation: ls, cd, pwd, mkdir, rmdir, touch, mv, cp, rm, tree
File Viewing and Text Manipulation: cat, less, more, head, tail, cut, awk, sed, wc, nl, grep
Searching: find, locate, grep, which, whereis
File Compression and Archiving: tar, gzip, gunzip, zip, unzip, xz, unxz
User and Permission Management: whoami, id, chmod, chown, chgrp, passwd, su, sudo
System Monitoring: top, htop, ps, uptime, vmstat, iostat, free, df, du, pgrep
Networking: nc, ping, curl, wget, ip, netstat, ss, dig, nslookup, traceroute
Package Management (Debian-based): apt update, apt upgrade, apt install, apt remove, dpkg -i
Package Management (RHEL/CentOS-based): yum install, yum update, yum remove, rpm -ivh
Disk and Filesystem: mount, umount, df, du, lsblk, fdisk, mkfs.ext4
#!/bin/bash — Always start with a shebang to specify the shell interpreter
set -e — Exit immediately if a command fails
set -u — Treat unset variables as errors
set -o pipefail — Return failure if any command in a pipeline fails
set -x — Enable debugging (prints commands as they are executed)
Use quotes around variables: "$var" to prevent word splitting and globbing
Use $(...) for command substitution instead of backticks `...`
Check exit status with $? or use conditional constructs
Use functions to modularize code and improve readability
Use meaningful variable names and comments
Avoid running scripts as root unless necessary
Validate inputs and handle errors gracefully
Clean up temporary files and resources on exit
Use trap to handle signals and cleanup properly
Prefer full paths to commands or ensure PATH is set properly
Test scripts in a safe environment before production use