Linux Commands Cheatsheet

Linux and Bash command reference — navigation, files, processes, networking, text processing, and scripting.

What it does

8 sections, 70+ commands

Covers navigation, files, viewing, search/text, processes, networking, scripting, and archives.

Real-world flags

Commands show the flags you actually use — e.g., 'ls -la', 'grep -rn', 'tar -xzf'.

Destructive-command warnings

rm -rf, kill -9, and other irreversible commands are flagged with explicit notes.

How to use Linux Commands Cheatsheet

  1. 1
    Find your command

    Search by keyword (e.g., 'grep', 'process', 'archive') or browse sections.

  2. 2
    Check the example

    Most commands include real-world examples with flags that actually matter.

  3. 3
    Copy and run

    Click copy and paste directly into your terminal. Replace placeholders in angle brackets.

  4. 4
    Note the warnings

    Commands like rm -rf and kill -9 are marked with destructive-operation notes.

Frequently Asked Questions

What is the difference between grep, sed, and awk?

grep searches for lines matching a pattern. sed is a stream editor for simple substitutions and line operations. awk is a full text-processing language best for field extraction and calculations. For a quick find, use grep. For find-and-replace, use sed. For column operations, use awk.

How do I run a command in the background?

Append & to the command: 'my-command &'. Use 'jobs' to list background jobs. 'fg' brings the most recent job to the foreground. For commands that should survive logout, use 'nohup my-command &'.

What is the difference between > and >> for redirection?

> redirects stdout to a file, overwriting it if it exists. >> appends to the file. 2>&1 redirects stderr to wherever stdout is going. Use 'command > out.log 2>&1' to capture all output including errors.

How do I find large files taking up disk space?

Use 'du -sh *' to see the size of items in the current directory. Pipe through sort: 'du -sh /* | sort -rh | head -20' to find the 20 largest directories.

Related Tools