The Rabbit Hole of Linux Commands
Source: Dev.to
Introduction
When your system’s storage is completely filled, performance degrades and you need to free space. Linux provides a set of commands that let you inspect, manage, and clean up files and directories efficiently.
Basic Navigation Commands
pwd
Displays the present working directory, helping you confirm where you are before removing files.
ls
Lists the contents of the current directory. Use options such as -l for a detailed view or -a to include hidden files.
cd
Changes the current directory.
cd ..Moves to the parent directory.cd ~or simplycdReturns to the user’s home directory.cd /Moves to the root of the filesystem.cd -Returns to the previous directory.
File Manipulation Commands
touch file.txt
Creates an empty file named file.txt (or updates the timestamp if it already exists).
mkdir directory_name
Creates a new directory.
rmdir directory_name
Removes an empty directory.
rm
Deletes files or directories.
rm file.txtRemoves a single file.rm -r directoryRecursively removes a directory and its contents.rm -rf directoryForce‑removes a directory without prompting.rm -rf .gitCommonly used to delete a Git repository folder.
cat file.txt
Outputs the contents of file.txt to the terminal.
Network Commands
curl
curl sends HTTP requests from the command line and displays the response.
Example: Register a test user via an API
curl -X POST http://localhost:3000/api/auth/signup \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "Test@123",
"fullName": "Test User"
}'
-X POSTSpecifies the request method (POST in this case).-H "Content-Type: application/json"Sets the request header to indicate JSON payload.-d '{...}'Provides the JSON data sent in the request body.
Visual Reference
This is the first entry in the Rabbit Hole series on Linux. We covered basic file‑system commands for cleaning up space and introduced curl for API testing. Future posts will explore curl in greater depth and demonstrate additional powerful Linux utilities.
