↓ Skip to main content

Essential Linux Commands for Developers and Sysadmins

Essential Linux Commands for Developers and Sysadmins

The Linux command line is one of the most important tools in a developer’s and system administrator’s daily workflow. Whether you’re inspecting hardware, managing files, configuring networking, troubleshooting production servers, or automating deployment tasks, knowing the right commands can save considerable time.

Linux provides a large collection of command-line utilities for almost every aspect of system administration. Some are used for everyday operations, while others are essential when diagnosing hardware problems, recovering filesystems, analyzing network traffic, or investigating system performance.

This guide organizes commonly used Linux commands into practical categories, covering system information, file management, permissions, package management, storage, networking, backups, and performance monitoring.

The examples primarily target mainstream Linux distributions such as Ubuntu, Debian, Fedora, and RHEL-based systems. Command availability and options can vary depending on the distribution, installed packages, and system configuration.

🖥️ 1. Basic System Information Commands
#

Before troubleshooting a Linux system, start by understanding its hardware, kernel, architecture, memory, and current operating environment.

These commands provide a quick overview of the machine.

Command Description
uname -a Display kernel and system information
uname -m Show processor architecture
uname -r Display the running kernel version
arch Display machine architecture
lscpu Show CPU architecture and processor information
sudo dmidecode -q Display BIOS and hardware information
cat /proc/cpuinfo Display CPU details
cat /proc/meminfo Display memory information
cat /proc/version Show kernel build information
cat /proc/net/dev Display network interface statistics
free -h Show memory and swap usage
lsblk List block devices
lspci -tv Display PCI device topology
lspci -nn List PCI devices with vendor and device IDs
lsusb -t Display USB device topology
date Display current system date and time
cal 2027 Display a calendar for 2027
timedatectl status Display timezone and clock synchronization status
sudo hwclock --systohc Synchronize the hardware clock from the system clock
ip -s link Display network interface statistics

For hardware diagnostics, dmidecode, lspci, and lsusb are particularly useful. They help identify the hardware configuration before investigating driver compatibility or peripheral problems.

Disk benchmarking can also be performed with hdparm:

  • sudo hdparm -I /dev/sdX — Display ATA device identification information.
  • sudo hdparm -tT /dev/sdX — Perform disk read-throughput tests.

Replace /dev/sdX with the correct device. The latter commands are intended for supported ATA devices and should not be assumed to work with every NVMe or virtual disk.

For modern Linux systems using systemd, timedatectl is generally more convenient than older clock-management utilities. See the official systemd timedatectl documentation.

🔄 2. Shutdown, Reboot, and Session Management
#

Linux provides several ways to shut down or restart a machine.

These operations should be performed carefully on production servers because they affect all running services and connected users.

Command Description
sudo shutdown -h now Shut down immediately
sudo shutdown -h +10 Schedule shutdown in 10 minutes
sudo shutdown -c Cancel a scheduled shutdown
sudo shutdown -r now Reboot immediately
sudo reboot Restart the system
sudo poweroff Power off the system
sudo systemctl reboot Reboot using systemd
sudo systemctl poweroff Shut down using systemd
init 0 Request shutdown through the init system
telinit 0 Legacy shutdown operation
logout End the current login shell

On modern systemd-based distributions, systemctl reboot and systemctl poweroff are generally preferred over legacy init commands.

For remote administration, check active sessions and notify users before shutting down shared production machines.

📂 3. File and Directory Management
#

File management is one of the most frequently performed tasks in Linux.

The following commands cover directory navigation, file creation, copying, moving, deletion, and symbolic links.

Directory Navigation
#

Command Description
pwd Display the current working directory
cd /home Change to /home
cd .. Move to the parent directory
cd ~ Return to the user’s home directory
cd - Return to the previous directory
ls List directory contents
ls -l Display detailed file information
ls -a Include hidden files
ls -lh Display file sizes in human-readable format
ls -lt Sort files by modification time

Creating and Managing Files
#

Command Description
mkdir dir1 Create a directory
mkdir -p /tmp/dir1/dir2 Create nested directories
rmdir dir1 Remove an empty directory
touch file1 Create a file or update its timestamp
file file1 Identify a file’s type
stat file1 Display file metadata
cp file1 file2 Copy a file
cp -a dir1 dir2 Copy a directory while preserving attributes
mv old new Move or rename a file or directory
ln file1 link1 Create a hard link
ln -s file1 link1 Create a symbolic link
rm file1 Remove a file
rm -r dir1 Remove a directory and its contents

Be particularly careful with rm -rf. It recursively deletes files without prompting and can cause serious data loss when used with an incorrect path.

Before running destructive commands, verify the current directory and target path.

For example, pwd and ls -la are useful checks before bulk file operations.

🔍 4. File Search and Command Discovery
#

Linux provides several utilities for locating files, searching directory trees, and identifying executable programs.

Finding Files
#

Command Description
find / -name file1 Search the filesystem for a filename
find /home -name "*.bin" Find files ending in .bin
find . -type f Find regular files recursively
find . -type d Find directories recursively
find /usr/bin -type f -atime +100 Find files not accessed for approximately 100 days
find /var/log -name "*.log" -mtime +30 Find log files modified more than 30 days ago
find . -size +100M Find files larger than 100 MB
find . -type f -empty Find empty files
find . -type f -name "*.c" Find C source files
locate "*.ps" Search the locate database for matching paths

The locate command relies on an indexed database. Depending on the distribution, the database may need to be updated using sudo updatedb.

The find command searches the filesystem directly and is more suitable when you need results based on current file attributes.

Locating Executable Commands
#

Command Description
which ls Display the executable path
whereis ls Find binary, source, and manual locations
command -v ls Identify how the shell resolves a command
type -a ls Show all matching command definitions

command -v and type -a are often more useful than which when investigating shell aliases, functions, and executable resolution.

💽 5. Mounting and Unmounting Filesystems
#

Linux uses a unified filesystem hierarchy. Storage devices and remote filesystems become accessible by mounting them at designated directories.

Mounting Filesystems
#

Command Description
findmnt Display mounted filesystems
lsblk -f Show block devices and filesystem information
sudo mount /dev/sdX1 /mnt/usb Mount a partition
sudo mount -t vfat /dev/sdX1 /mnt/usb Mount a FAT-compatible filesystem
sudo mount -o loop,ro image.iso /mnt/iso Mount an ISO image as read-only
mount -t ext4 Specify the ext4 filesystem type when mounting
findmnt /mnt/usb Check which filesystem is mounted at a path

Unmounting Filesystems
#

Command Description
sudo umount /mnt/usb Unmount a filesystem
sudo umount /dev/sdX1 Unmount a partition
sudo fuser -vm /mnt/usb Identify processes using a mount point
sudo umount -l /mnt/usb Perform a lazy unmount

A filesystem should normally be unmounted before removing its storage device.

If unmounting fails because the filesystem is busy, use fuser or lsof to identify processes accessing it.

Avoid blindly killing processes to force an unmount. Commands that terminate users of a filesystem can interrupt applications and cause data loss.

The lazy unmount option detaches a filesystem from the visible hierarchy while outstanding references are released. It is not a substitute for a clean storage-removal procedure.

📊 6. Disk Space and Storage Management
#

Disk usage problems are common on production Linux systems, particularly when logs, databases, container images, or temporary files accumulate.

These commands help identify storage capacity and large directories.

Command Description
df -h Display filesystem usage
df -T Show filesystem types
df -i Display inode usage
du -sh dir1 Show total directory size
du -sh -- * Display sizes of items in the current directory
du -h --max-depth=1 /var Show sizes of immediate subdirectories
du -sk * | sort -rn Sort directory and file sizes numerically
ls -lhS List files sorted by size
lsblk Display block devices
blkid Display filesystem UUIDs and types

One common troubleshooting mistake is checking disk space with df while ignoring inode exhaustion.

A filesystem may still have free capacity but be unable to create additional files because its available inodes have been consumed.

Use df -i to investigate this situation.

For interactive disk analysis, tools such as ncdu can provide a convenient directory-size overview.

👥 7. User and Group Management
#

Linux uses users and groups to control access to files, processes, and system resources.

User-management commands are commonly needed when configuring servers, granting development access, and maintaining production environments.

Command Description
whoami Display the current username
id user1 Display user and group IDs
groups user1 List a user’s groups
groupadd devs Create a group
groupdel devs Delete a group
useradd -m user1 Create a user and home directory
passwd user1 Set or change a user’s password
usermod -aG devs user1 Add a user to an additional group
usermod -s /bin/bash user1 Change the user’s login shell
userdel user1 Delete a user account
userdel -r user1 Delete a user and associated home directory
chage -l user1 Display password and account aging information
sudo chage -E 2027-12-31 user1 Set an account expiration date

When adding a user to a supplementary group, remember to include -a with -G.

Without -a, the usermod -G operation replaces the existing supplementary group list rather than appending to it.

After group membership changes, the user may need to start a new login session before the updated permissions take effect.

🔐 8. Linux File Permissions and Ownership
#

Linux permissions determine which users can read, modify, or execute files.

The standard permission categories are:

  • Owner: The file’s owning user.
  • Group: Members of the owning group.
  • Others: All other users.

Each category can have read (r), write (w), and execute (x) permissions.

Permission Management Commands
#

Command Description
ls -l Display file permissions
ls -lh Display permissions and human-readable sizes
chmod 755 file1 Set owner to rwx and group/others to r-x
chmod 644 file1 Set owner to rw- and group/others to r–
chmod +x script.sh Add executable permission
chmod go-rwx dir1 Remove group and others permissions
chmod -R 755 dir1 Recursively change permissions
chown user1 file1 Change file owner
chown user1:group1 file1 Change owner and group
chgrp group1 file1 Change file group
umask Display the default permission mask
sudo find / -xdev -type f -perm -4000 Find files with the SUID permission bit

Understanding Permission Values
#

The numeric representation uses three bits:

Permission Value
Read (r) 4
Write (w) 2
Execute (x) 1

For example:

  • 755 means owner rwx, group r-x, and others r-x.
  • 644 means owner rw-, group r--, and others r--.
  • 700 means only the owner has access.

Recursive permission changes should be used carefully. Applying 755 indiscriminately to a directory tree can make files executable when they should not be.

🛡️ 9. File Attributes: chattr and lsattr
#

Linux filesystems may support additional file attributes beyond conventional permissions.

Two commonly used utilities are chattr and lsattr.

Command Description
lsattr file1 Display file attributes
sudo chattr +i file1 Set the immutable attribute
sudo chattr -i file1 Remove the immutable attribute
sudo chattr +a file1 Set append-only mode
sudo chattr -a file1 Remove append-only mode
sudo lsattr -R dir1 Display attributes recursively

The immutable attribute prevents ordinary modification, deletion, or renaming of a file while it remains set.

The append-only attribute allows data to be appended but prevents ordinary modification or truncation.

These attributes can be useful for protecting selected configuration files or log files.

Support depends on the filesystem and its configuration. Administrative privileges can also remove these attributes, so they should not be treated as a complete security mechanism.

📦 10. File Compression and Archiving
#

Compression reduces storage requirements, while archiving combines multiple files into a single package.

Linux provides several utilities for these operations.

tar Archives
#

Command Description
tar -cvf archive.tar file1 dir1 Create a TAR archive
tar -xvf archive.tar Extract a TAR archive
tar -tvf archive.tar List archive contents
tar -czvf archive.tar.gz dir1 Create a gzip-compressed archive
tar -xzvf archive.tar.gz Extract a gzip-compressed archive
tar -cjvf archive.tar.bz2 dir1 Create a bzip2-compressed archive
tar -xjvf archive.tar.bz2 Extract a bzip2-compressed archive
tar -cJvf archive.tar.xz dir1 Create an xz-compressed archive
tar -xJvf archive.tar.xz Extract an xz-compressed archive

gzip and zip
#

Command Description
gzip file1 Compress a file using gzip
gunzip file1.gz Decompress a gzip file
gzip -k file1 Keep the original file when compressing
zip archive.zip file1 Create a ZIP archive
zip -r archive.zip dir1 Archive a directory recursively
unzip archive.zip Extract a ZIP archive
unzip -l archive.zip List ZIP archive contents

Remember that gzip file1 normally replaces the original file with its compressed version. Use gzip -k when you need to retain the source file.

📥 11. Linux Package Management: RPM, DNF, YUM, DEB, and APT
#

Package managers install, update, remove, and maintain software dependencies.

The package-management tools depend on the Linux distribution.

RPM-Based Distributions
#

Commonly used by RHEL, Rocky Linux, AlmaLinux, and Fedora.

Command Description
rpm -ivh package.rpm Install an RPM package
rpm -Uvh package.rpm Upgrade or install an RPM package
rpm -e package Remove an installed RPM package
rpm -qa List installed RPM packages
rpm -qi package Display package information
rpm -ql package List files installed by a package
dnf install package Install a package using DNF
dnf update Update available packages
dnf remove package Remove a package
dnf search package Search package repositories
dnf info package Display package information
yum install package Install a package using YUM

DNF is the current package-management tool on modern Fedora and newer RHEL-based systems. YUM remains available as a compatibility command on some distributions.

Debian-Based Distributions
#

Commonly used by Debian, Ubuntu, and their derivatives.

Command Description
dpkg -i package.deb Install a DEB package
dpkg -r package Remove a package
dpkg -l List installed packages
dpkg -L package List package files
apt update Refresh package indexes
apt upgrade Upgrade installed packages
apt full-upgrade Perform upgrades that may add or remove packages
apt install package Install a package
apt install ./package.deb Install a local DEB package
apt remove package Remove a package
apt purge package Remove a package and its system configuration
apt autoremove Remove automatically installed unused dependencies
apt search package Search available packages
apt show package Display package information

A common workflow on Debian-based systems is:

  1. Run sudo apt update to refresh package metadata.
  2. Run sudo apt upgrade to update installed packages.
  3. Review any package changes before accepting them.

dpkg -i installs a local package but does not automatically resolve all missing dependencies. Using apt install ./package.deb is often more convenient when dependency resolution is required.

📄 12. Viewing and Monitoring File Contents
#

Linux provides several utilities for displaying file contents.

These commands are especially useful when inspecting configuration files, application output, and system logs.

Command Description
cat file1 Display file contents
tac file1 Display file contents in reverse line order
more file1 View a file page by page
less file1 Browse a file interactively
head file1 Display the first 10 lines
head -n 20 file1 Display the first 20 lines
tail file1 Display the last 10 lines
tail -n 50 file1 Display the last 50 lines
tail -f logfile Follow new log entries
tail -F logfile Follow a log file across rotation
nl file1 Display line numbers
wc -l file1 Count lines

For large log files, less is generally preferable to cat because it does not attempt to print the entire file immediately.

To monitor application logs in real time, tail -F is useful when log rotation may replace the underlying file.

🔎 13. Text Processing: grep, sed, awk, sort, and uniq
#

Text-processing tools are fundamental to Linux administration and shell scripting.

They allow developers to search logs, extract data, transform text, and combine command output without writing a separate program.

Command Description
grep "error" logfile Search for matching lines
grep -i "error" logfile Search without case sensitivity
grep -n "error" logfile Include matching line numbers
grep -r "TODO" ./src Search recursively
grep -v "debug" logfile Exclude matching lines
sed 's/old/new/g' file1 Replace text in output
sed -n '1,20p' file1 Print lines 1–20
awk '{print $1,$3}' file1 Print the first and third fields
awk -F: '{print $1}' /etc/passwd Extract usernames
sort file1 Sort lines
sort -r file1 Sort lines in reverse order
sort -u file1 Sort and remove duplicate lines
sort file1 | uniq Remove adjacent duplicate lines after sorting
uniq -c file1 Count adjacent duplicate lines
wc -l file1 Count lines
wc -w file1 Count words
cut -d: -f1 /etc/passwd Extract the first colon-separated field
tr 'a-z' 'A-Z' Convert lowercase input to uppercase
diff file1 file2 Compare two files
tee output.txt Write input to both a file and standard output

One important detail: uniq only detects consecutive duplicate lines. To remove duplicates across an entire unsorted file, use sort -u or sort file1 | uniq.

These tools are particularly useful for log analysis and automated troubleshooting.

💾 14. Filesystem Creation and Disk Management
#

Linux includes utilities for checking, creating, and managing filesystems and swap space.

These operations affect storage devices directly and must be performed carefully.

Command Description
lsblk -f Display devices and filesystem types
blkid Display filesystem identifiers
sudo fdisk -l List disk partitions
sudo fsck /dev/sdX1 Check a supported filesystem
sudo mkfs.ext4 /dev/sdX1 Create an ext4 filesystem
sudo mkswap /dev/sdX2 Initialize a swap partition
sudo swapon /dev/sdX2 Enable swap space
sudo swapoff /dev/sdX2 Disable swap space
swapon --show Display active swap devices
findmnt Display mount information

Two commands deserve special attention.

mkfs creates a filesystem and normally destroys the existing filesystem structures on the selected target.

fsck checks and repairs filesystem inconsistencies. For many filesystems, it should be run on an unmounted filesystem. Follow the documentation for the specific filesystem before attempting repairs.

Never execute filesystem creation or repair commands against a production disk without verifying the device name and ensuring that the required backup and recovery procedures are in place.

💿 15. Backup, Restore, and File Synchronization
#

Backups are essential for protecting application data, configuration files, and system images.

Linux provides several ways to create archives, synchronize directories, and produce raw disk images.

File and Directory Backups
#

Command Description
tar -cvf backup.tar /home Create a TAR backup
tar -xvf backup.tar Extract an archive
tar -czvf backup.tar.gz /home Create a compressed backup
rsync -av /home/ /backup/home/ Synchronize directory contents
rsync -av --delete /home/ /backup/home/ Synchronize and remove destination files absent from the source
rsync -av --dry-run /home/ /backup/home/ Preview synchronization changes
rsync -avz user@host:/data/ ./data/ Copy remote files over SSH

The --delete option is potentially destructive because it removes destination files that do not exist in the source.

Use --dry-run first when validating synchronization rules.

Raw Disk Imaging with dd
#

The dd command copies data at a low level and can be used to create disk images.

For example:

Command Description
sudo dd if=/dev/sdX of=disk.img bs=4M status=progress conv=fsync Create a raw disk image
sudo dd if=disk.img of=/dev/sdX bs=4M status=progress conv=fsync Restore an image to a disk

Here:

  • if specifies the input source.
  • of specifies the output destination.
  • bs specifies the block size.
  • status=progress displays progress information.
  • conv=fsync requests synchronization of output data before completion.

The dd command does not provide the same safeguards as a typical file-copy utility. Reversing the input and output devices can overwrite the wrong disk.

Always verify the source and destination with lsblk before running a disk-imaging operation.

🌐 16. Linux Networking Commands
#

Networking commands are essential for troubleshooting connectivity, checking interface configuration, inspecting open ports, and capturing packets.

Modern Linux systems generally use the iproute2 tools instead of the older net-tools utilities.

Network Interface Management
#

Command Description
ip addr show Display interface addresses
ip link show List network interfaces
ip link set dev eth0 up Enable a network interface
ip link set dev eth0 down Disable a network interface
ip route show Display routing information
ip neigh show Display neighbor and ARP information
ip -s link Display interface statistics
nmcli device status Display NetworkManager device status
nmcli connection show List network connections
nmcli device wifi list List available Wi-Fi networks

Legacy commands such as ifconfig and ifup may still be available on some systems, but they are not the preferred tools on modern distributions.

The ip command provides a more comprehensive interface for managing addresses, routes, and network devices.

See Red Hat’s networking command migration reference for additional details about modern replacements.

Connectivity and DNS
#

Command Description
ping google.com Test network connectivity
ping -c 4 example.com Send four ICMP echo requests
traceroute example.com Trace the network path
tracepath example.com Trace a network path
nslookup example.com Perform a DNS lookup
dig example.com Query DNS records
dig MX example.com Query mail exchange records
whois example.com Query domain registration information
curl -I https://example.com Retrieve HTTP response headers
wget https://example.com/file Download a file

Listening Ports and Network Connections
#

Command Description
ss -tuln Display listening TCP and UDP sockets
ss -tulnp Display listening sockets and associated processes
ss -tan Display TCP connections
lsof -i List processes using network sockets
tcpdump -i eth0 Capture packets on an interface
tcpdump -i eth0 'tcp port 80' Capture TCP traffic on port 80
tcpdump -nn -i eth0 Capture packets without resolving names

The older netstat -tulnp command is still found in many legacy administration scripts. Its modern replacement is generally ss -tulnp.

Packet captures can contain sensitive application data. Use tcpdump only on networks and devices you are authorized to monitor.

📈 17. System Monitoring and Performance Troubleshooting
#

System monitoring helps identify CPU bottlenecks, memory pressure, storage problems, and runaway processes.

These commands are useful during both routine administration and production incident investigation.

Process Monitoring
#

Command Description
top Display running processes and system utilization
htop Interactive process monitor
ps aux List running processes
ps aux | grep nginx Search for Nginx processes
pgrep -a nginx Find processes by name
pidof nginx Display process IDs
kill PID Send the default termination signal
kill -9 PID Send SIGKILL to a process
pkill nginx Send a signal to matching processes
pstree -p Display the process hierarchy

Use SIGTERM through kill PID or pkill when possible, giving applications an opportunity to shut down cleanly. Reserve SIGKILL for cases where a process cannot terminate normally.

CPU and Memory Monitoring
#

Command Description
uptime Display system uptime and load averages
free -h Display memory utilization
vmstat 1 Report memory, process, and CPU statistics every second
lscpu Display processor information
mpstat -P ALL 1 Monitor CPU utilization per processor
sar -u 1 5 Collect CPU utilization samples
top Monitor processes and resource consumption

Commands such as vmstat, mpstat, and sar may require the sysstat package.

Disk and I/O Monitoring
#

Command Description
df -h Check filesystem capacity
df -i Check inode availability
du -sh /var/log Check log directory size
iostat -xz 1 Monitor storage device performance
iotop Display processes performing disk I/O
lsblk Inspect storage devices

A system can experience poor responsiveness even when CPU utilization is low. High disk latency, memory pressure, and blocked I/O operations are common causes.

System Load and Diagnostics
#

Command Description
dmesg -T Display kernel messages with readable timestamps
journalctl -b Display logs from the current boot
journalctl -p err -b Display current-boot error messages
systemctl status Display system service manager status
watch -n 2 free -h Refresh memory statistics every two seconds

For a system that recently experienced a failure, journalctl -b -1 can help inspect messages from the previous boot, provided persistent journal storage is enabled.

⚙️ 18. Linux Service and Process Management with systemd
#

Most modern Linux distributions use systemd to manage system initialization, background services, and service dependencies.

The systemctl command is therefore one of the most important administration tools to understand.

Command Description
systemctl status nginx Display service status
sudo systemctl start nginx Start a service
sudo systemctl stop nginx Stop a service
sudo systemctl restart nginx Restart a service
sudo systemctl reload nginx Reload service configuration
sudo systemctl enable nginx Enable automatic startup
sudo systemctl disable nginx Disable automatic startup
systemctl is-active nginx Check whether a service is active
systemctl is-enabled nginx Check whether a service is enabled
systemctl list-units --type=service List loaded services
systemctl list-unit-files List installed unit files
journalctl -u nginx Display service logs
journalctl -u nginx -f Follow service logs continuously

A useful troubleshooting sequence is to inspect the service status first, then review its logs.

For example, if Nginx fails to start, systemctl status nginx provides the service state, while journalctl -u nginx -b can reveal errors from the current boot.

Service management commands that modify system state generally require administrator privileges.

🔑 19. Remote Access and File Transfer
#

SSH is the standard method for secure remote administration of Linux systems.

It also supports secure file transfer and remote command execution.

Command Description
ssh user@192.168.1.100 Connect to a remote Linux machine
ssh -p 2222 user@host Connect using a custom SSH port
ssh-keygen -t ed25519 Generate an SSH key pair
ssh-copy-id user@host Install a public key on a remote host
scp file user@host:/tmp/ Copy a file to a remote machine
scp user@host:/tmp/file ./ Copy a remote file locally
sftp user@host Start an interactive file transfer session
rsync -av ./data/ user@host:/backup/data/ Synchronize files over SSH
ssh user@host 'uptime' Execute a remote command

For automated administration, SSH key authentication is generally preferable to repeatedly entering passwords.

Protect private keys with appropriate permissions and passphrases, and avoid disabling host-key verification in production automation.

⏰ 20. Shell Environment and Scheduled Tasks
#

Shell utilities and scheduling commands help automate repetitive administrative tasks.

Environment and Shell Management
#

Command Description
env Display environment variables
printenv PATH Display a specific environment variable
export PATH=$PATH:/opt/bin Add a directory to PATH
alias ll='ls -lah' Define a shell alias
unalias ll Remove an alias
history Display command history
clear Clear the terminal
man ls Display a command manual
help cd Display shell built-in help
which gcc Locate a command
type gcc Identify how the shell resolves a command

Scheduling Tasks with cron
#

Cron runs scheduled commands according to a time-based configuration.

Command Description
crontab -l List current user’s scheduled jobs
crontab -e Edit scheduled jobs
crontab -r Remove the current user’s crontab
sudo crontab -l List root’s scheduled jobs

A cron entry uses five time fields:

minute hour day-of-month month day-of-week command

For example:

0 2 * * * /usr/local/bin/backup.sh

This schedules the backup script to run every day at 02:00, using the cron daemon’s configured timezone.

Always ensure scheduled scripts use appropriate absolute paths and handle logging, permissions, and failures correctly.


📚 21. Additional Linux Command-Line Resources
#

Learning Linux commands is not simply about memorizing syntax. The real value comes from understanding how commands can be combined to solve practical administration and development problems.

For additional examples and shell techniques, see these related resources:

For unfamiliar commands, man command and command --help are usually the best starting points. They provide option details for the tools installed on the actual target machine.

Linux command behavior can differ between distributions and software versions. On production systems, check the local manual pages before using commands that modify partitions, change permissions recursively, terminate processes, or overwrite storage devices.

Related