The tar command creates and extracts archive files on Linux and macOS. Combined with gzip or bzip2, it produces compressed archives widely used for backups and distribution. Create a Compressed Archive tar -czvf archive.tar.gz /path/to/folder Extract an Archive tar -xzvf archive.tar.gz Extract to a Specific Directory tar -xzvf archive.tar.gz -C /destination/ List Archive Contents tar -tzvf archive.tar.gz Create a bzip2 Archive tar -cjvf archive.tar.bz2 /path/to/folder
Utilities
Utilities, tooling, and system helpers.
Monitoring log files in real time is a critical skill for system administrators. The tail and grep commands are your primary tools for this task. Follow a Log File in Real Time tail -f /var/log/syslog Show Last N Lines tail -n 100 /var/log/nginx/error.log Filter Logs with grep tail -f /var/log/nginx/access.log | grep "404" Search Across Multiple Log Files grep -r "ERROR" /var/log/ Case-Insensitive Search grep -i "warning" /var/log/syslog Show Context Around a Match grep -C 3 "segfault" /var/log/syslog
curl is a command-line tool for making HTTP requests. It is indispensable for testing REST APIs, downloading files, and debugging web services. Basic GET Request curl https://api.example.com/users POST Request with JSON Body curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name": "John", "email": "[email protected]"}' Set Authorization Header curl -H "Authorization: Bearer YOUR_TOKEN" https://api.example.com/me Save Response to File curl -o response.json…
Git is the most widely used version control system. This guide walks through installing Git, configuring your identity, and creating your first repository. Install Git sudo apt install git # Debian/Ubuntu brew install git # macOS Configure Identity git config --global user.name "Your Name" git config --global user.email "[email protected]" Initialize a Repository mkdir myproject && cd myproject git init git add . git commit -m "Initial commit" Connect to GitHub git remote add origin https://github.com/user/repo.git…
Rsync is the standard tool for fast, incremental file transfer and synchronization on Linux and macOS. It copies only what has changed, making it very efficient for backups. Basic Syntax rsync -avz source/ destination/ Sync to a Remote Server rsync -avz -e ssh /local/path/ user@server:/remote/path/ Dry Run (Preview Changes) rsync -avzn source/ destination/ Exclude Files rsync -avz --exclude="*.log" --exclude="node_modules/" source/ destination/ Delete Files Removed from Source rsync -avz --delete source/…