PUBLIC REFERENCE // LINUX

Linux & Bash Commands

Linux permissions and process management are built on a small set of primitives — users, groups, and signals — that show up again and again once you learn to read them, whether you're debugging a stuck process or fixing a permission error.

Commands
117
Sections
10
Source policy
Official links

FIELD NOTES

Decisions worth remembering

  • chmod's numeric mode is just three octal digits (owner/group/other) added from read=4, write=2, execute=1 — 755 means rwxr-xr-x.
  • Always quote variables in scripts ("$var"), not just for spaces — an unset or empty variable can otherwise make a command like rm -rf $dir/* dangerously ambiguous.
  • kill sends SIGTERM by default, which a process can ignore or handle gracefully; kill -9 (SIGKILL) can't be caught and should be a last resort since it skips cleanup.
  • Piping into xargs is usually faster and safer than backticks or $() in a loop for running a command over many files, and it handles filenames with spaces better with -print0/-0.

LINUX // REFERENCE

File & Directory

25 commands
rm file.txt

Remove a file

Safety: This command can discard data, stop work, or remove resources. Replace placeholders and verify the exact target in a disposable environment first.

rm -rf directory/

Remove directory and all contents

Safety: This command can discard data, stop work, or remove resources. Replace placeholders and verify the exact target in a disposable environment first.

LINUX // REFERENCE

File Permissions

7 commands
chmod -R 644 directory/

Set permissions recursively

permissionsrecursive
GNU chmod documentation

Safety: This command can discard data, stop work, or remove resources. Replace placeholders and verify the exact target in a disposable environment first.

LINUX // REFERENCE

Process Management

13 commands
kill -9 PID

Force kill a process (SIGKILL)

Safety: This command can discard data, stop work, or remove resources. Replace placeholders and verify the exact target in a disposable environment first.

LINUX // REFERENCE

Networking

15 commands
curl -X POST -H "Content-Type: application/json" -d '{"key":"val"}' https://api.example.com

POST JSON data

wget https://example.com/file.zip

Download a file (alternative)

networkdownload
GNU Wget manual

LINUX // REFERENCE

Text Processing

16 commands
awk -F',' '{print $2}' file.csv

Set delimiter and print column 2

xargs rm

Pass stdin as arguments to a command

Safety: This command can discard data, stop work, or remove resources. Replace placeholders and verify the exact target in a disposable environment first.

jq .name data.json

Query JSON data (if jq installed)

textjsonjq
jq manual

LINUX // REFERENCE

Compression & Archives

8 commands
tar -czf archive.tar.gz directory/

Create gzipped tar archive

archivetargzip
GNU tar manual
tar -xzf archive.tar.gz -C /dest/

Extract to specific directory

archivetarextract
GNU tar manual

LINUX // REFERENCE

Disk Usage

5 commands
ncdu

Interactive disk usage viewer (if installed)

diskinteractive
ncdu manual

LINUX // REFERENCE

User Management

9 commands

LINUX // REFERENCE

Environment Variables

8 commands

COMMON QUESTIONS

Linux command FAQ

What is the difference between chmod 755 and chmod 644?

755 gives the owner rwx and everyone else r-x (used for directories and executables); 644 gives the owner rw and everyone else read-only (used for regular files).

How do I find which process is using a specific port?

sudo lsof -i :8080 or sudo ss -tulpn | grep 8080.

What does the number after a signal mean, like kill -9?

It's the signal number — 9 is SIGKILL (immediate, un-catchable termination); 15 (the default) is SIGTERM, a request the process can catch and clean up after.

Why does rm sometimes fail with "Directory not empty"?

Plain rm won't remove directories at all — you need rm -r for recursive removal, and -f to suppress prompts or ignore missing files.