---
title: Terminal commands worth remembering
date: 2026-10-21 22:00
tags: [linux, cheatsheet]
description: A running list of shell one-liners that are easy to forget and handy to have.
---

A cheat sheet that will keep growing. Everything here works in Bash on most Linux distributions.

## Files

```bash
# Biggest things in the current directory
du -sh * | sort -rh | head

# Files changed in the last day
find . -type f -mtime -1

# Copy a folder somewhere else, with a progress bar
rsync -ah --info=progress2 src/ dest/
```

## Searching

```bash
# Search recursively, with line numbers
grep -rn "TODO" .

# The same, but much faster and it respects .gitignore
rg "TODO"
```

## Processes

| Command | What it does |
|---|---|
| `htop` | Interactive process viewer |
| `ps aux --sort=-%mem \| head` | Top memory users |
| `kill -9 <pid>` | Stop a process that won't stop |
| `lsof -i :8080` | What's using port 8080? |

## Networking

```bash
# What's my public IP?
curl ifconfig.me

# Which ports are listening?
ss -tulpn

# Follow a log file as it grows
tail -f /var/log/syslog
```

## History tricks

- `!!` repeats the last command, so `sudo !!` reruns it as root
- <kbd>Ctrl</kbd>+<kbd>R</kbd> searches back through your history
- `cd -` jumps back to the previous directory
