Category

Utilities

Utilities, tooling, and system helpers.

How to Compress and Archive Files with tar

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 Archivetar -czvf archive.tar.gz /path/to/folderExtract an Archivetar -xzvf archive.tar.gzExtract to a Specific Directorytar -xzvf archive.tar.gz -C /destination/List Archive Contentstar -tzvf archive.tar.gzCreate a bzip2…

How to Monitor Logs with tail and grep

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 Timetail -f /var/log/syslogShow Last N Linestail -n 100 /var/log/nginx/error.logFilter Logs with greptail -f /var/log/nginx/access.log | grep "404"Search Across Multiple Log Filesgrep -r "ERROR" /var/log/Case-Insensitive…

How to Use curl for API Testing

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 Requestcurl https://api.example.com/usersPOST Request with JSON Bodycurl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name": "John", "email": "[email protected]"}'Set Authorization Headercurl -H "Authorization: Bearer YOUR_TOKEN"…

How to Set Up Git on Linux and macOS

Git is the most widely used version control system. This guide walks through installing Git, configuring your identity, and creating your first repository.Install Gitsudo apt install git # Debian/Ubuntu brew install git # macOSConfigure Identitygit config --global user.name "Your Name" git config --global user.email "[email protected]"Initialize a Repositorymkdir myproject && cd myproject git init git add . git commit -m "Initial…

How to Use Rsync for File Synchronization

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 Syntaxrsync -avz source/ destination/Sync to a Remote Serverrsync -avz -e ssh /local/path/ user@server:/remote/path/Dry Run (Preview Changes)rsync -avzn source/ destination/Exclude Filesrsync -avz --exclude="*.log" --exclude="node_modules/" source/…