pwd Print Working Directory Show the full path of the current directory.
Example
$ pwd
/home/jane/projects/api Essential terminal commands explained in plain English — with examples and the exact words to use when describing them in a standup or code review.
Last reviewed:
cat Concatenate and print Print the entire contents of a file to the terminal.
$ cat .env
DATABASE_URL=postgres://...
PORT=3000 less Less View a file page by page — press q to quit, / to search.
$ less server.log
# press / then type a word to search
# press q to quit head Head Show the first N lines of a file (default 10).
$ head server.log
$ head -n 50 server.log # first 50 lines tail Tail Show the last N lines of a file. -f follows new output in real time.
$ tail server.log
$ tail -n 100 server.log
$ tail -f server.log # "follow" — watch live log output grep Global Regular Expression Print Search for a pattern inside files or command output.
$ grep "error" server.log
$ grep -r "TODO" src/ # recursive search
$ grep -i "Error" server.log # case-insensitive
$ grep -n "port" config.yml # show line numbers
$ cat server.log | grep "500" # pipe: filter output chmod Change Mode Change the read/write/execute permissions of a file.
$ chmod +x deploy.sh # make a script executable
$ chmod 600 .env # owner read/write only
$ chmod 644 README.md # owner rw, others read-only
$ chmod -R 755 public/ # recursive chown Change Owner Change the owner (user and group) of a file or directory.
$ chown www-data:www-data html/
$ chown -R jane:staff src/ sudo SuperUser Do Run a command as the root (administrator) user.
$ sudo apt install nginx
$ sudo systemctl restart nginx
$ sudo nano /etc/hosts ps Process Status List running processes.
$ ps aux # all processes, detailed
$ ps aux | grep node # find Node.js processes kill Kill Send a signal to a process, usually to terminate it.
$ kill 12345 # send SIGTERM (graceful stop)
$ kill -9 12345 # send SIGKILL (force stop)
$ killall node # kill all processes named "node" top / htop Table of Processes / Interactive Process Viewer Live view of CPU and memory usage by process. htop is the friendly version.
$ top
$ htop # if installed; q to quit, F2 to configure curl Client URL Make HTTP requests from the command line.
$ curl https://api.example.com/health
$ curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name":"Jane"}'
$ curl -I https://example.com # headers only wget Web Get Download files from a URL.
$ wget https://example.com/archive.zip
$ wget -O output.zip https://example.com/archive.zip ssh Secure Shell Log in to a remote server securely over the network.
$ ssh user@192.168.1.10
$ ssh -i ~/.ssh/my-key.pem ubuntu@ec2-1-2-3-4.compute.amazonaws.com
$ ssh -p 2222 user@example.com # non-default port scp Secure Copy Protocol Copy files between local machine and a remote server over SSH.
$ scp file.txt user@server:/home/user/
$ scp user@server:/var/log/app.log ./logs/
$ scp -r dist/ user@server:/var/www/html/ tar Tape Archive Create or extract .tar (and .tar.gz) archives.
$ tar -czf archive.tar.gz dist/ # compress folder
$ tar -xzf archive.tar.gz # extract
$ tar -tzf archive.tar.gz # list contents without extracting
# Flags: c=create, x=extract, z=gzip, f=filename, t=list zip / unzip Zip / Unzip Create or extract .zip archives.
$ zip -r archive.zip dist/
$ unzip archive.zip
$ unzip archive.zip -d output/ # extract to a directory echo Echo Print text or variable values to the terminal.
$ echo "Hello, world!"
$ echo $HOME
$ echo $NODE_ENV env Environment List all environment variables, or run a command with a specific environment.
$ env # list all env vars
$ env | grep NODE # filter env vars
$ env NODE_ENV=production node app.js export Export Set an environment variable so child processes inherit it.
$ export NODE_ENV=production
$ export PORT=3000
$ export DATABASE_URL="postgres://localhost/mydb" source Source Run a script in the current shell — useful for loading .env files or updating PATH.
$ source .env
$ source ~/.bashrc
$ . ~/.zshrc # dot is an alias for source which Which Show the full path of a command executable.
$ which node
/usr/local/bin/node
$ which python3 man Manual Show the manual page (documentation) for a command.
$ man grep
$ man ssh
# press q to quit
# use --help for a short summary: grep --help | (pipe) Pipe Send the output of one command as the input to the next.
$ cat server.log | grep "ERROR" | tail -n 20
$ ps aux | grep node
$ ls -la | less > and >> Redirect output > overwrites a file with output. >> appends to a file.
$ echo "build failed" > error.txt # overwrite
$ cat server.log >> all-logs.txt # append
$ npm run build 2>&1 | tee build.log # tee: write to file AND show in terminal Phrases engineers actually use when talking about terminal work.
head prints the first N lines of a file (default 10), while tail prints the last N lines. tail also supports the -f ("follow") flag, which keeps the terminal open and streams new lines as they are appended — the standard way to watch a live log file in real time.
rm -r deletes a directory and everything inside it recursively, but still prompts for confirmation on write-protected files. Adding -f (force) skips those confirmation prompts entirely, so rm -rf removes a directory tree unconditionally and permanently — there is no recycle bin, so a mistyped path with -rf cannot be undone.
cat prints a file's entire contents to the terminal at once, which is fine for short files but floods the screen for large ones. less opens the file page by page, letting you scroll with arrow keys, search with /, and quit with q — the better choice for long log files or man pages.
chmod +x adds execute permission to a file for its permission classes, which is required before you can run a script directly (e.g. ./deploy.sh) rather than passing it to an interpreter (bash deploy.sh). Without execute permission, attempting to run the file directly returns a "Permission denied" error even if you can read its contents.
The pipe | sends the standard output of one command directly into the standard input of the next command, chaining them together (e.g. ps aux | grep node). The > operator instead redirects a command's output into a file, overwriting whatever was there — while >> appends to the file instead of overwriting it.
A plain kill <pid> sends SIGTERM, a graceful termination signal the process can catch and use to clean up (close file handles, flush data) before exiting. kill -9 <pid> sends SIGKILL, which the operating system enforces immediately and the process cannot intercept or ignore — useful when a process is hung, but it skips any cleanup the process would otherwise have done.
scp (Secure Copy Protocol) copies files between machines by tunneling the transfer over an existing SSH connection, reusing the same authentication (keys or password) and encryption as an interactive ssh session. If you can ssh into a host, you can scp files to and from it using the same credentials.
Setting VAR=value in a shell creates a variable visible only to that shell session. Running export VAR=value marks it as an environment variable that child processes — scripts, or programs launched from that shell — inherit automatically. Forgetting export is a common reason a variable a script depends on appears to be "missing" when the script runs.
curl -I sends a HEAD request and prints only the response headers, without downloading the response body — useful for quickly checking a server's status code, content type, or caching headers without transferring the full page or file.
The commands listed (ls, grep, chmod, curl, ssh, tar, and so on) are standard Unix/Linux utilities available in effectively any POSIX-compatible shell, including bash, zsh, and the Git Bash environment on Windows — the syntax shown works the same regardless of which shell is running them.