You do not need to memorize every Linux command to become useful in a terminal. Most development and server troubleshooting starts with a few repeated actions: find files, inspect content, check processes, test network access, and confirm environment variables.
This guide is organized by problem, not by alphabet.
Files and directories
List files:
ls
ls -la
-l shows detailed metadata. -a includes hidden files. When checking a project directory, permissions, symlinks, or deployment output, ls -la is often the first command.
Move around:
cd /var/www
cd ..
cd -
cd - switches between the previous directory and the current one, which is useful during deployment or log inspection.
Create directories:
mkdir logs
mkdir -p apps/freemac/current
-p creates missing parent directories.
Copy and move:
cp .env.example .env
mv old.log archive.log
cp -r public/images backup/images
Remove files carefully:
rm app.log
rm -r dist
Do not make rm -rf your default. Run pwd and ls first when the path matters.
Find files:
find . -name "*.md"
find /var/log -name "nginx*"
Inside a code repository, rg is usually faster for text search. Use find for filesystem-level discovery.
View file content
Use cat for small files:
cat package.json
Use less for long logs and configs:
less /var/log/nginx/error.log
Use tail for recent log lines:
tail -n 50 /var/log/nginx/error.log
tail -f /var/log/nginx/access.log
tail -f follows new lines as they arrive, which is useful during a restart or live request test.
Processes and resources
List processes:
ps aux
ps aux | grep nginx
Use this when you need to confirm whether a service is running, who started it, and what PID it has.
Watch resource usage:
top
If a server suddenly becomes slow, first check whether CPU or memory is saturated.
Stop a process:
kill 12345
kill -9 12345
Try normal kill first. Use -9 only when the process does not respond, because it skips the application's cleanup path.
Network checks
Use curl for HTTP diagnostics:
curl https://example.com
curl -I https://example.com
curl -v http://127.0.0.1:3000/
curl -v is especially useful when debugging reverse proxies, local services, and container port forwarding. Test the upstream service directly before blaming the proxy.
Check IP addresses and routes:
ip addr
ip route
On modern Linux distributions, ip is usually preferred over older ifconfig examples.
Connect over SSH:
ssh user@example.com
ssh -p 2222 user@example.com
For repeated development and deployment work, use SSH keys rather than typing passwords every time.
Download a file:
wget https://example.com/archive.tar.gz
curl can also download files, but wget remains a familiar choice for straightforward downloads.
Environment variables
Inspect variables:
env
printenv PATH
When something works locally but fails on a server, missing environment variables are one of the first things to check.
Set a variable for the current shell:
export NODE_ENV=production
Set a variable only for one command:
NODE_ENV=production node server.js
Do not paste real secrets into public logs, screenshots, or issue comments. Environment output can contain tokens and database URLs.
A small troubleshooting flow
For a service that is not responding:
pwd
ls -la
ps aux | grep node
tail -n 100 app.log
curl -v http://127.0.0.1:3000/
printenv NODE_ENV
The goal is to verify where you are, what files exist, whether the process is running, what it logged, whether the port responds, and whether the runtime environment is correct.
Related FreeMac guides
- For Docker-specific commands, read Docker CLI Commands: Containers, Images, Logs, and Cleanup.
- For project configuration files, read Front-End Config: Env, Node, Git, ESLint, and TypeScript.
- For Homebrew on Mac, read Homebrew Guide: A Package Manager for Developers and Everyday Users.
Continue reading
Docker CLI Commands: Containers, Images, Logs, and Cleanup
A practical Docker command guide for checking containers, reading logs, inspecting configuration, entering running containers, managing volumes, and cleaning disk safely.
11 min readDockerfile and .dockerignore for Node.js Apps
Build cleaner Node.js Docker images by controlling the build context, using cache-friendly COPY order, applying multi-stage builds, and keeping secrets out of image layers.
9 min readlocalhost vs 0.0.0.0 in Docker: What They Mean
Understand why a Dockerized app bound to localhost may be unreachable, when to bind to 0.0.0.0, and how port publishing changes access from the host and network.
Subscribe to FreeMac
Weekly picks: free Mac software reviews, trusted source updates, alternatives, and low-friction guides.