Showing 110 of 110 commands
Copy, move, remove, link, and permission files safely from the terminal
cp -av src/ backup/beginnerCopy files or directories while preserving attributes and showing progress.
cp -r templates/ releases/templates/beginnerRecursively copy a directory and everything inside it.
mv old-name.txt new-name.txtbeginnerRename a file or move it to another directory.
rm -rf build/intermediateForce-remove files or directories recursively.
mkdir -p logs/archive/2024/07beginnerCreate nested directories without failing if parents already exist.
touch deploy.logbeginnerCreate an empty file or update its modification timestamp.
touch -d "2024-01-01 00:00" audit.logintermediateSet a file timestamp manually for testing or restore workflows.
ln -s /opt/app/current /srv/www/appintermediateCreate a symbolic link that points to another file or directory.
ln existing.txt hardlink.txtadvancedCreate a hard link that references the same inode as the original file.
chmod 644 app.confbeginnerSet read-write for owner and read-only for group and others.
chmod u+x deploy.shbeginnerAdd execute permission for the file owner using symbolic mode.
chmod -R 750 scripts/intermediateRecursively apply restrictive directory and file permissions.
chown -R deploy:devops /srv/appintermediateChange file ownership recursively to a user and group.
Inspect, search, transform, and compare text directly from the command line
cat /etc/os-releasebeginnerPrint a file to standard output exactly as stored.
grep -n "ERROR" app.logbeginnerSearch for matching text and show the line numbers for each hit.
grep -Rin "DATABASE_URL" .intermediateSearch recursively through a project for a string or pattern.
awk -F: '{print $1, $7}' /etc/passwdadvancedSplit input into fields and print selected columns or computed values.
sed -n '1,20p' file.txtintermediatePrint only a selected range of lines from a file.
sed 's/http:/https:/g' urls.txtintermediateReplace matching text in a stream using sed substitution syntax.
cut -d: -f1 /etc/passwdbeginnerExtract specific delimiter-separated fields from each input line.
sort -u hosts.txtbeginnerSort lines alphabetically and remove duplicates in one step.
uniq -c access.logintermediateCollapse adjacent duplicate lines and count their occurrences.
wc -l app.logbeginnerCount lines, words, or bytes in a file or stream.
head -n 20 server.logbeginnerShow the first lines of a file for quick inspection.
tail -f /var/log/nginx/access.logbeginnerFollow the end of a growing log file in real time.
diff -u old.conf new.confintermediateCompare two files and show unified diff output.
less +G /var/log/syslogbeginnerOpen a file in a pager for efficient scrolling, searching, and navigation.
Monitor processes, adjust priorities, manage jobs, and inspect system services
ps auxbeginnerList every running process with CPU, memory, user, and command details.
pgrep -af nodeintermediateFind process IDs and commands by pattern without scanning raw ps output manually.
topbeginnerOpen the built-in live process monitor for CPU and memory analysis.
htopbeginnerUse an interactive, colorized process viewer with easier sorting and filtering.
kill -15 1234intermediateSend SIGTERM so a process can shut down gracefully.
kill -9 1234intermediateForce-kill a stuck process using SIGKILL when graceful shutdown fails.
killall nginxintermediateSignal all processes with the same name at once.
nice -n 10 tar -czf backup.tar.gz /srv/dataadvancedStart a process with lower CPU scheduling priority.
nohup npm run start > app.log 2>&1 &intermediateRun a command immune to hangups so it keeps running after logout.
jobsbeginnerList background and stopped jobs in the current shell session.
bg %1intermediateResume a stopped shell job and continue it in the background.
fg %1intermediateBring a background or stopped job back into the foreground.
systemctl status nginxbeginnerCheck the current state, logs, and unit details for a systemd service.
systemctl restart nginxbeginnerRestart a service managed by systemd.
journalctl -u nginx -fintermediateFollow logs from a specific systemd service in real time.
Inspect interfaces, test connectivity, transfer files, and troubleshoot ports
ip addr showbeginnerDisplay IP addresses and status for all network interfaces.
ip route showintermediateInspect the kernel routing table and default gateway configuration.
ifconfig -abeginnerShow interface configuration using the legacy net-tools command set.
ping -c 4 8.8.8.8beginnerTest reachability and round-trip latency to a host.
curl -I https://example.combeginnerFetch HTTP headers to verify status codes, redirects, and server metadata.
wget -O backup.html https://example.combeginnerDownload a remote resource and save it to a chosen filename.
ss -tulpnintermediateList listening TCP and UDP sockets with associated processes.
netstat -tulpnintermediateDisplay active listening ports and bound services with the classic networking tool.
nmap -sV 192.168.1.10advancedScan a target host for open ports and detected service versions.
ssh devops@server.example.combeginnerOpen an encrypted remote shell session over SSH.
scp app.tar.gz devops@server:/srv/releases/intermediateSecurely copy files between local and remote systems over SSH.
rsync -avz ./site/ devops@server:/var/www/site/intermediateSynchronize files efficiently while transferring only deltas.
nc -vz localhost 5432intermediateTest whether a TCP port is reachable using netcat.
Manage accounts, groups, identity, privilege escalation, and permission models
whoamibeginnerPrint the effective username of the current shell session.
idbeginnerShow the current user ID, group ID, and supplementary groups.
sudo -lintermediateList the commands the current user may run with sudo.
su - deployintermediateSwitch to another user account with a full login shell.
passwdbeginnerChange the password for the current account.
useradd -m -s /bin/bash aliceintermediateCreate a new user with a home directory and default Bash shell.
usermod -aG docker aliceintermediateAppend a user to an additional supplementary group.
userdel -r aliceintermediateDelete a user account and remove its home directory.
groupadd devopsintermediateCreate a new system group for shared access control.
groups alicebeginnerList all groups that a user belongs to.
chmod 755 deploy.shbeginnerSet owner read-write-execute and read-execute for group and others using octal mode.
chmod 640 /etc/myapp.envbeginnerRestrict a sensitive file to owner read-write and group read-only using octal permissions.
chown -R alice:devops /srv/appintermediateRecursively set both owner and group for an application directory.
Inspect block devices, mount filesystems, partition disks, and archive data
df -hTbeginnerShow disk usage with human-readable sizes and filesystem types.
du -sh /var/logbeginnerMeasure how much space a directory consumes.
lsblk -fbeginnerList block devices, partitions, filesystems, and mount points.
mount | column -tintermediateDisplay all currently mounted filesystems in an easy-to-scan format.
mount /dev/sdb1 /mnt/dataintermediateMount a filesystem at a chosen directory so it becomes accessible.
umount /mnt/dataintermediateUnmount a filesystem cleanly before removing or reformatting it.
fdisk -ladvancedList disk partitions and geometry using the classic partitioning utility.
parted -ladvancedInspect partition tables with GNU Parted, including GPT layouts.
mkfs.ext4 /dev/sdb1advancedCreate an ext4 filesystem on a partition or block device.
tar -czf backup.tar.gz /etc/nginxbeginnerCreate a compressed tar archive from files or directories.
tar -xzf backup.tar.gzbeginnerExtract a gzip-compressed tar archive into the current directory.
gzip -k app.logbeginnerCompress a file with gzip while keeping the original copy.
zip -r artifacts.zip dist/beginnerCreate a ZIP archive recursively from a folder or file set.
unzip artifacts.zip -d restore/beginnerExtract a ZIP archive into a target directory.
Write safer shell scripts with variables, control flow, arrays, pipes, and cron
#!/usr/bin/env bashbeginnerUse a portable shebang so the script runs with Bash from the current environment.
set -euo pipefailintermediateExit on errors, treat unset variables as failures, and catch pipe errors early.
ENVIRONMENT="production"beginnerAssign a shell variable without spaces around the equals sign.
echo "${ENVIRONMENT^^}"intermediateExpand a variable and transform it to uppercase using Bash string operations.
if [[ -f .env ]]; then echo "found"; fibeginnerRun commands conditionally when a file, string, or status test succeeds.
case "$1" in start|stop|restart) echo "ok" ;; *) exit 1 ;; esacintermediateDispatch different logic branches based on an input argument.
for file in *.log; do gzip "$file"; donebeginnerLoop over matching files and run the same command for each one.
while read -r host; do ping -c 1 "$host"; done < hosts.txtintermediateRead input line by line from standard input or a file safely.
sum() { echo "$(( $1 + $2 ))"; }intermediateDefine a reusable shell function that accepts positional parameters.
servers=("web-1" "web-2" "web-3")beginnerCreate a Bash array for managing multiple related values.
echo "${servers[@]}"intermediateExpand every array element as separate words.
command > out.log 2> err.logbeginnerRedirect standard output and standard error to different files.
command >> app.log 2>&1beginnerAppend both stdout and stderr to the same log file.
journalctl -u nginx | grep ERROR | tee errors.logintermediatePipe output through multiple commands and save a copy with tee.
(crontab -l; echo "0 2 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1") | crontab -advancedInstall a recurring cron job that runs a command on a fixed schedule.
A complete Linux command reference for DevOps workflows, server administration, shell productivity, and bash scripting. Search practical Linux terminal commands, copy examples instantly, and master the CLI faster.
devopslesson.com/tools/cheatsheets/linux
pwdbeginnerPrint the full path of your current working directory.
pwd💡 Use this before destructive commands so you know exactly where you are.
ls -lahbeginnerList files with permissions, owners, sizes, and hidden entries in a readable format.
ls -lah /etc/nginx💡 Add --group-directories-first on supported systems to keep folders at the top.
cd /var/logbeginnerChange into another directory by absolute or relative path.
cd ~/projects/devops-lesson💡 Use cd - to jump back to your previous directory instantly.
find . -type f -name "*.log"intermediateSearch recursively for files matching a name pattern.
find /var/log -type f -name "*.log"💡 Combine find with -mtime, -size, or -exec for precise cleanup and audits.
find . -type f -mtime -1intermediateLocate files modified within the last day.
find . -type f -mtime -7locate sshd_configbeginnerQuery the locate database for files by name almost instantly.
locate docker-compose.yml💡 If results look stale, refresh the database with sudo updatedb.
tree -L 2beginnerDisplay directory contents as a tree up to a chosen depth.
tree -L 2 app/toolsdu -sh .beginnerShow the total size of the current directory in human-readable form.
du -sh /var/lib/dockerdu -sh * | sort -hintermediateRank files and folders by size to find what is consuming space.
du -sh /var/* | sort -h💡 Great for identifying oversized logs, caches, and build artifacts.
df -hbeginnerShow mounted filesystem capacity, usage, and free space.
df -h💡 Use df -i too when you suspect inode exhaustion rather than disk exhaustion.
realpath ./script.shbeginnerResolve a relative path into its canonical absolute path.
realpath ../configs/prod.envstat /etc/passwdintermediateInspect detailed file metadata like size, inode, mode, and timestamps.
stat deploy.shbasename /var/log/nginx/access.logbeginnerExtract the filename portion from a full path.
basename /srv/releases/2024-10-01.tar.gz💡 Use dirname for the parent path when building scripts that split file locations.
cp -av src/ backup/beginnerCopy files or directories while preserving attributes and showing progress.
cp -av config/ config.backup/💡 Use -a for backups because it preserves permissions, symlinks, and timestamps.
cp -r templates/ releases/templates/beginnerRecursively copy a directory and everything inside it.
cp -r assets/ dist/assets/mv old-name.txt new-name.txtbeginnerRename a file or move it to another directory.
mv app.log /var/log/archive/app.log💡 Add -n to avoid overwriting an existing destination file.
rm -rf build/intermediateForce-remove files or directories recursively.
rm -rf .next/cache💡 Run pwd and ls first when using rm -rf in production paths.
mkdir -p logs/archive/2024/07beginnerCreate nested directories without failing if parents already exist.
mkdir -p /srv/app/releases/2024-07-14touch deploy.logbeginnerCreate an empty file or update its modification timestamp.
touch .env.localtouch -d "2024-01-01 00:00" audit.logintermediateSet a file timestamp manually for testing or restore workflows.
touch -d "yesterday" build.markerln -s /opt/app/current /srv/www/appintermediateCreate a symbolic link that points to another file or directory.
ln -s /var/log/nginx/access.log access.log💡 Symlinks are ideal for release switching because the target can change atomically.
ln existing.txt hardlink.txtadvancedCreate a hard link that references the same inode as the original file.
ln /var/log/app.log /var/log/app.log.linkchmod 644 app.confbeginnerSet read-write for owner and read-only for group and others.
chmod 644 /etc/nginx/nginx.conf💡 644 is common for config files that should not be executable.
chmod u+x deploy.shbeginnerAdd execute permission for the file owner using symbolic mode.
chmod u+x scripts/release.shchmod -R 750 scripts/intermediateRecursively apply restrictive directory and file permissions.
chmod -R 750 /srv/app/binchown -R deploy:devops /srv/appintermediateChange file ownership recursively to a user and group.
chown -R www-data:www-data /var/www/html💡 Use chgrp -R devops shared/ when you only need to update the group.
cat /etc/os-releasebeginnerPrint a file to standard output exactly as stored.
cat README.mdgrep -n "ERROR" app.logbeginnerSearch for matching text and show the line numbers for each hit.
grep -n "Connection refused" /var/log/syslog💡 Add -i for case-insensitive matching and -C 3 for nearby context.
grep -Rin "DATABASE_URL" .intermediateSearch recursively through a project for a string or pattern.
grep -Rin "listen 443" /etc/nginxawk -F: '{print $1, $7}' /etc/passwdadvancedSplit input into fields and print selected columns or computed values.
awk '{print $1, $5}' access.log💡 AWK shines when you need lightweight reporting without opening a spreadsheet.
sed -n '1,20p' file.txtintermediatePrint only a selected range of lines from a file.
sed -n '50,80p' /etc/nginx/nginx.confsed 's/http:/https:/g' urls.txtintermediateReplace matching text in a stream using sed substitution syntax.
sed 's/localhost/127.0.0.1/g' .env.example💡 Use sed -i.bak for in-place edits while keeping a backup copy.
cut -d: -f1 /etc/passwdbeginnerExtract specific delimiter-separated fields from each input line.
cut -d, -f2,4 inventory.csvsort -u hosts.txtbeginnerSort lines alphabetically and remove duplicates in one step.
sort -u domains.txtuniq -c access.logintermediateCollapse adjacent duplicate lines and count their occurrences.
sort ips.txt | uniq -c | sort -nr💡 Remember to sort first unless duplicate lines are already adjacent.
wc -l app.logbeginnerCount lines, words, or bytes in a file or stream.
wc -l *.loghead -n 20 server.logbeginnerShow the first lines of a file for quick inspection.
head -n 5 .env.exampletail -f /var/log/nginx/access.logbeginnerFollow the end of a growing log file in real time.
tail -f app.log💡 Use tail -n 100 -f to start with recent history before following new entries.
diff -u old.conf new.confintermediateCompare two files and show unified diff output.
diff -u .env.example .env.productionless +G /var/log/syslogbeginnerOpen a file in a pager for efficient scrolling, searching, and navigation.
less README.md💡 Inside less, press / to search forward and n to jump to the next match.
ps auxbeginnerList every running process with CPU, memory, user, and command details.
ps aux | grep nginxpgrep -af nodeintermediateFind process IDs and commands by pattern without scanning raw ps output manually.
pgrep -af ssh💡 Pair pgrep with pkill in real life, but use pgrep first so you know what will match.
topbeginnerOpen the built-in live process monitor for CPU and memory analysis.
tophtopbeginnerUse an interactive, colorized process viewer with easier sorting and filtering.
htop💡 htop is ideal for quickly spotting noisy processes and sending signals interactively.
kill -15 1234intermediateSend SIGTERM so a process can shut down gracefully.
kill -15 $(pgrep -f "node server.js")kill -9 1234intermediateForce-kill a stuck process using SIGKILL when graceful shutdown fails.
kill -9 28491💡 Prefer SIGTERM first because SIGKILL skips cleanup hooks and can corrupt temp state.
killall nginxintermediateSignal all processes with the same name at once.
killall nodenice -n 10 tar -czf backup.tar.gz /srv/dataadvancedStart a process with lower CPU scheduling priority.
nice -n 15 rsync -av /data /backupnohup npm run start > app.log 2>&1 &intermediateRun a command immune to hangups so it keeps running after logout.
nohup python3 -m http.server 8080 > server.log 2>&1 &jobsbeginnerList background and stopped jobs in the current shell session.
jobsbg %1intermediateResume a stopped shell job and continue it in the background.
bg %2fg %1intermediateBring a background or stopped job back into the foreground.
fg %1systemctl status nginxbeginnerCheck the current state, logs, and unit details for a systemd service.
systemctl status docker💡 Use systemctl is-active service-name in scripts when you only need a health check.
systemctl restart nginxbeginnerRestart a service managed by systemd.
sudo systemctl restart sshdjournalctl -u nginx -fintermediateFollow logs from a specific systemd service in real time.
journalctl -u docker --since today💡 Add -n 100 to review recent lines before following live output.
ip addr showbeginnerDisplay IP addresses and status for all network interfaces.
ip addr show eth0💡 Use ip -br addr for a concise summary on modern Linux distributions.
ip route showintermediateInspect the kernel routing table and default gateway configuration.
ip route showifconfig -abeginnerShow interface configuration using the legacy net-tools command set.
ifconfig -a💡 Prefer ip addr on newer systems because ifconfig is deprecated on many distros.
ping -c 4 8.8.8.8beginnerTest reachability and round-trip latency to a host.
ping -c 4 github.comcurl -I https://example.combeginnerFetch HTTP headers to verify status codes, redirects, and server metadata.
curl -I https://api.github.com💡 Use curl -sS for scripts so errors remain visible without a progress meter.
wget -O backup.html https://example.combeginnerDownload a remote resource and save it to a chosen filename.
wget https://releases.hashicorp.com/terraform.zipss -tulpnintermediateList listening TCP and UDP sockets with associated processes.
ss -tulpn | grep :443💡 ss is the modern replacement for many netstat use cases.
netstat -tulpnintermediateDisplay active listening ports and bound services with the classic networking tool.
netstat -tulpn | grep :80nmap -sV 192.168.1.10advancedScan a target host for open ports and detected service versions.
nmap -Pn -p 22,80,443 server.internal💡 Use nmap only on systems you are authorized to assess.
ssh devops@server.example.combeginnerOpen an encrypted remote shell session over SSH.
ssh -i ~/.ssh/prod.pem ubuntu@10.0.1.25scp app.tar.gz devops@server:/srv/releases/intermediateSecurely copy files between local and remote systems over SSH.
scp -r dist/ ubuntu@10.0.1.25:/var/www/app/rsync -avz ./site/ devops@server:/var/www/site/intermediateSynchronize files efficiently while transferring only deltas.
rsync -avz --delete ./build/ deploy@web-01:/srv/www/current/💡 rsync is safer and faster than repeated full scp uploads for deployments.
nc -vz localhost 5432intermediateTest whether a TCP port is reachable using netcat.
nc -vz db.internal 3306💡 Netcat is perfect for quick smoke tests when curl or ssh are too specific.
whoamibeginnerPrint the effective username of the current shell session.
whoamiidbeginnerShow the current user ID, group ID, and supplementary groups.
id deploysudo -lintermediateList the commands the current user may run with sudo.
sudo -l💡 Useful when diagnosing why a deployment user cannot run a privileged action.
su - deployintermediateSwitch to another user account with a full login shell.
su - postgrespasswdbeginnerChange the password for the current account.
passwd aliceuseradd -m -s /bin/bash aliceintermediateCreate a new user with a home directory and default Bash shell.
sudo useradd -m -s /bin/bash deployusermod -aG docker aliceintermediateAppend a user to an additional supplementary group.
sudo usermod -aG sudo alice💡 Always include -a with -G so you do not overwrite existing group memberships.
userdel -r aliceintermediateDelete a user account and remove its home directory.
sudo userdel -r tempusergroupadd devopsintermediateCreate a new system group for shared access control.
sudo groupadd developersgroups alicebeginnerList all groups that a user belongs to.
groups deploychmod 755 deploy.shbeginnerSet owner read-write-execute and read-execute for group and others using octal mode.
chmod 755 /usr/local/bin/backup.sh💡 755 is common for scripts that should be executable but not writable by everyone.
chmod 640 /etc/myapp.envbeginnerRestrict a sensitive file to owner read-write and group read-only using octal permissions.
chmod 640 /srv/app/.envchown -R alice:devops /srv/appintermediateRecursively set both owner and group for an application directory.
chown -R www-data:www-data /var/www/app💡 Pair chown with chmod to fully correct both ownership and access mode issues.
df -hTbeginnerShow disk usage with human-readable sizes and filesystem types.
df -hTdu -sh /var/logbeginnerMeasure how much space a directory consumes.
du -sh /var/lib/dockerlsblk -fbeginnerList block devices, partitions, filesystems, and mount points.
lsblk -f💡 Run lsblk before mounting a new disk so you target the correct device.
mount | column -tintermediateDisplay all currently mounted filesystems in an easy-to-scan format.
mount | column -tmount /dev/sdb1 /mnt/dataintermediateMount a filesystem at a chosen directory so it becomes accessible.
sudo mount /dev/nvme1n1p1 /dataumount /mnt/dataintermediateUnmount a filesystem cleanly before removing or reformatting it.
sudo umount /data💡 Use lsof or fuser first if umount reports that the device is busy.
fdisk -ladvancedList disk partitions and geometry using the classic partitioning utility.
sudo fdisk -l /dev/sdbparted -ladvancedInspect partition tables with GNU Parted, including GPT layouts.
sudo parted -lmkfs.ext4 /dev/sdb1advancedCreate an ext4 filesystem on a partition or block device.
sudo mkfs.ext4 /dev/nvme1n1p1💡 Formatting destroys data, so verify the device name carefully with lsblk first.
tar -czf backup.tar.gz /etc/nginxbeginnerCreate a compressed tar archive from files or directories.
tar -czf release.tar.gz dist/tar -xzf backup.tar.gzbeginnerExtract a gzip-compressed tar archive into the current directory.
tar -xzf release.tar.gz -C /srv/releases/gzip -k app.logbeginnerCompress a file with gzip while keeping the original copy.
gzip -k access.logzip -r artifacts.zip dist/beginnerCreate a ZIP archive recursively from a folder or file set.
zip -r configs.zip nginx/ systemd/unzip artifacts.zip -d restore/beginnerExtract a ZIP archive into a target directory.
unzip backup.zip -d restore/#!/usr/bin/env bashbeginnerUse a portable shebang so the script runs with Bash from the current environment.
#!/usr/bin/env bash💡 Place the shebang on the first line of every executable Bash script.
set -euo pipefailintermediateExit on errors, treat unset variables as failures, and catch pipe errors early.
set -euo pipefail💡 This is one of the best defaults for safer production shell scripts.
ENVIRONMENT="production"beginnerAssign a shell variable without spaces around the equals sign.
BACKUP_DIR="/srv/backups"echo "${ENVIRONMENT^^}"intermediateExpand a variable and transform it to uppercase using Bash string operations.
echo "${branch:-main}"💡 Parameter expansion like ${var:-default} is cleaner than many small if statements.
if [[ -f .env ]]; then echo "found"; fibeginnerRun commands conditionally when a file, string, or status test succeeds.
if [[ -d logs ]]; then rm -rf logs; ficase "$1" in start|stop|restart) echo "ok" ;; *) exit 1 ;; esacintermediateDispatch different logic branches based on an input argument.
case "$ENV" in prod) URL=prod ;; dev) URL=dev ;; esacfor file in *.log; do gzip "$file"; donebeginnerLoop over matching files and run the same command for each one.
for host in web-1 web-2 web-3; do ssh "$host" uptime; donewhile read -r host; do ping -c 1 "$host"; done < hosts.txtintermediateRead input line by line from standard input or a file safely.
while read -r line; do echo "$line"; done < .env💡 Use -r with read so backslashes are not interpreted unexpectedly.
sum() { echo "$(( $1 + $2 ))"; }intermediateDefine a reusable shell function that accepts positional parameters.
deploy() { ssh "$1" "sudo systemctl restart app"; }servers=("web-1" "web-2" "web-3")beginnerCreate a Bash array for managing multiple related values.
files=(Dockerfile docker-compose.yml .env)echo "${servers[@]}"intermediateExpand every array element as separate words.
for server in "${servers[@]}"; do echo "$server"; donecommand > out.log 2> err.logbeginnerRedirect standard output and standard error to different files.
npm run build > build.log 2> build.err💡 Use 2>/dev/null only when you deliberately want to hide expected noise.
command >> app.log 2>&1beginnerAppend both stdout and stderr to the same log file.
python3 worker.py >> worker.log 2>&1journalctl -u nginx | grep ERROR | tee errors.logintermediatePipe output through multiple commands and save a copy with tee.
cat access.log | awk '{print $1}' | sort | uniq -c💡 Pipes let each tool do one job well, which is the Unix philosophy in practice.
(crontab -l; echo "0 2 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1") | crontab -advancedInstall a recurring cron job that runs a command on a fixed schedule.
(crontab -l; echo "*/5 * * * * /usr/local/bin/healthcheck.sh") | crontab -💡 Cron uses a minimal environment, so prefer absolute paths for commands and files.