Reference

Tips & tricks

Small things that make Linux faster, easier and more fun. Each tip is marked with the level it fits: Novice Intermediate Advanced. Pick the ones you like.

Note

Keyboard shortcuts differ a little between desktops. When a tip only works on some, it says so. You can view and change all shortcuts in Settings β†’ Keyboard.

Desktop & keyboard

TipHowLevel
Launch anything by typingPress Super, type the first letters of an app ("lib" for LibreOffice) and press Enter. Faster than any menu.N
Middle-click pasteSelect text, then press the scroll wheel where you want it. No Ctrl+C needed. It's a separate clipboard, so your normal copied text stays intact.N
Snap windowsSuper+←/β†’ for half the screen, Super+↑ to maximise.N
Workspaces: several "desktops"Keep e-mail on one, work on another, music on a third. Switch with Ctrl+Alt+←/β†’ (Mint), Super+Page Up/Page Down (GNOME) or Super+Ctrl+←/β†’ (KDE).N
Screenshot of just one areaMint: Shift+Print Screen. GNOME: Print Screen opens a tool where you drag a rectangle. KDE: Super+Shift+Print Screen.N
Emoji pickerCtrl+. in most GNOME apps, Super+. on KDE. πŸŽ‰N
Night lightSettings β†’ Display β†’ Night Light makes the screen warmer in the evening, which is easier on the eyes.N
Move a window by any spotHold Super (or Alt on some desktops) and drag anywhere inside the window. Handy when the title bar is off-screen.I
Quick commandAlt+F2 opens a small "run" box, like Win+R on Windows. On KDE, Alt+Space opens KRunner, which also does sums and unit conversions.I
Your own shortcutsSettings β†’ Keyboard β†’ Custom Shortcuts. For example, set Super+T to open the terminal.I
Clipboard historyKDE has one built in (Super+V). On other desktops, install a clipboard manager such as CopyQ.I

Files app

TipHowLevel
Show hidden filesCtrl+H toggles files starting with a dot.N
Type a locationCtrl+L lets you type a path like /etc or ~/Downloads.N
Just start typingIn a folder, type a filename to jump to it or search for it.N
Bookmark favourite foldersOpen the folder and press Ctrl+D, or drag it into the sidebar.N
Rename many files at onceSelect them all and press F2. GNOME Files and Dolphin offer a batch rename with numbering or find-and-replace. On Mint, use the Bulky app.N
TabsCtrl+T opens a new tab, just like in a browser. Drag files between tabs.N
"New Document" templatesPut any file, such as an empty letter with your address, into your ~/Templates folder. It then appears under right-click β†’ New Document.I
Open a terminal right hereRight-click empty space in a folder β†’ Open in Terminal.I
Drag a file into the terminalIts full path is typed for you, with quotes if needed.I
Browse another computerCtrl+L and type sftp://user@192.168.1.50 (Linux, via SSH) or smb://192.168.1.50 (Windows shares and NAS drives).A

Terminal: keyboard shortcuts

These work in Bash, the standard shell on almost every distro.

KeysWhat it doesLevel
Tab / TabTabComplete a name / show all possible completionsN
↑ / ↓Previous / next commandN
Ctrl+CStop the running commandN
Ctrl+Shift+C / VCopy / pasteN
Ctrl+Shift+TNew terminal tabN
Ctrl++ / Ctrl+-Bigger / smaller textN
Ctrl+RSearch your history. Type part of an old command, press Ctrl+R again for older matches, Enter to run it.I
Ctrl+A / Ctrl+EJump to the start / end of the lineI
Ctrl+← / β†’Jump one word left / rightI
Ctrl+UDelete everything before the cursor (great for a mistyped password)I
Ctrl+WDelete the word before the cursorI
Ctrl+LClear the screenI
Ctrl+DLog out / close the terminal (on an empty line)I
Alt+.Insert the last word of the previous command. Press again for earlier ones.A
Ctrl+Z, then fgPause a program (e.g. an editor), do something else, then return to itA

Terminal: clever tricks

Forgot sudo? Novice

$ apt install vlc
E: Could not open lock file ... (13: Permission denied)
$ sudo !!          # "!!" means "the previous command", so this re-runs it with sudo

Get quick, practical examples instead of long manuals Novice

$ sudo apt install tldr       # or: dnf / pacman, the package is called "tldr" or "tealdeer"
$ tldr tar                    # shows a handful of common examples, e.g. how to unpack an archive

Jump back and forth Novice

$ cd /etc/systemd
$ cd ~/Documents
$ cd -            # back to /etc/systemd
$ cd -            # and back to ~/Documents

Create folders in one go Intermediate

$ mkdir -p Projects/website/{images,css,scripts}
# creates Projects, Projects/website and three folders inside it

The {a,b,c} part is called brace expansion: the shell writes it out as three separate names.

Quick backup copy of a file Intermediate

$ cp settings.conf{,.bak}
# expands to: cp settings.conf settings.conf.bak

Repeat a command from history Intermediate

$ history | grep ssh
  412  ssh anna@192.168.1.50
$ !412            # run command number 412 again

Watch something change live Intermediate

$ watch -n 2 df -h                 # re-run every 2 seconds (Ctrl+C to stop)
$ tail -f ~/logfile.txt            # show new lines as they're added to a file

Search inside "less" and "man" Intermediate

While reading with less or man, type / followed by a word and press Enter. n jumps to the next match, N to the previous one, q quits.

Terminal looks garbled? Intermediate

If you accidentally displayed a binary file and the text turned into strange symbols, type reset and press Enter, even if you can't see what you're typing.

Run a command that keeps going after you close the terminal Advanced

$ nohup ./long-job.sh > job.log 2>&1 &

For long-running work over SSH, learn tmux. It keeps your terminal session alive even if the connection drops, and you can reconnect with tmux attach.

Time a command Advanced

$ time cp -r ~/Pictures /media/anna/USB/
real    0m42.318s

Find out why a command isn't found Advanced

$ type ll          # is it an alias, a function, or a program?
ll is aliased to `ls -lah'
$ command -v python3
/usr/bin/python3

On Ubuntu and Fedora, typing a command that isn't installed usually suggests which package provides it.

Handy one-liners

A one-liner is a single line of commands that does a useful job, often several small commands joined with a pipe (|). If pipes and > are new to you, read Level 3 Β· Pipes, redirection and searching first.

Try it: make a practice file first

Many examples below use this small spending list. Paste this line into a terminal to create it:

$ printf "date,item,amount\n2026-11-01,coffee,3.50\n2026-11-02,books,24.00\n2026-11-03,coffee,3.50\n2026-11-04,bus,2.80\n" > expenses.csv
$ cat expenses.csv
date,item,amount
2026-11-01,coffee,3.50
2026-11-02,books,24.00
2026-11-03,coffee,3.50
2026-11-04,bus,2.80

ls: listing files Novice

# biggest files first, with readable sizes
$ ls -lhS

# most recently changed first, show only the top
$ ls -lt | head

# oldest first, so the newest end up right above your prompt
$ ls -ltr

# only folders
$ ls -d */

# only files ending in .jpg
$ ls *.jpg

# include hidden files, but not "." and ".."
$ ls -A

# everything inside, including sub-folders
$ ls -R ~/Projects

# how many items are in this folder?
$ ls | wc -l

find: locating files Intermediate

# files bigger than 1 GB in your home
$ find ~ -type f -size +1G

# files changed in the last hour
$ find . -type f -mmin -60

# count your JPG photos (any case)
$ find ~/Pictures -type f -iname "*.jpg" | wc -l

# empty folders
$ find . -type d -empty

# make every .sh script runnable
$ find . -name "*.sh" -exec chmod +x {} +

# .log files older than 30 days…
$ find . -type f -name "*.log" -mtime +30

# …and delete them
$ find . -type f -name "*.log" -mtime +30 -delete

-exec … {} + runs a command on the files found. {} is replaced by the file names.

Careful

Always run a find command without -delete first, check the list, and only then add -delete to the end. Deleted files don't go to the Trash.

grep: searching text Intermediate

# search all files: recursive, ignore case, line numbers
$ grep -rni "invoice" ~/Documents

# only list the names of files that match
$ grep -rl "password" .

# count matching lines β†’ 2
$ grep -c "coffee" expenses.csv

# lines that do NOT match
$ grep -v "coffee" expenses.csv

# match either word
$ grep -E "coffee|bus" expenses.csv

# show 1 line before and 3 after each match
$ grep -A 3 -B 1 "error" app.log

# whole word only: "cat", not "category"
$ grep -w "cat" story.txt

# a config file without comments or blank lines
$ grep -Ev '^\s*(#|$)' /etc/ssh/sshd_config

# everything about USB since startup
$ journalctl -b | grep -i usb

sed: find and replace Advanced

sed ("stream editor") changes text as it flows past. Its most common use is s/old/new/g: substitute old with new, globally (every match on a line, not just the first).

# show the result, file is NOT changed
$ sed 's/coffee/tea/g' expenses.csv

# change the file, keep the original as expenses.csv.bak
$ sed -i.bak 's/coffee/tea/g' expenses.csv

# print only lines 2 to 3
$ sed -n '2,3p' expenses.csv

# everything except line 1 (the header)
$ sed '1d' expenses.csv

# remove lines starting with #
$ sed '/^#/d' settings.conf

# remove empty lines
$ sed '/^$/d' notes.txt

# remove spaces at the ends of lines
$ sed -i 's/[[:space:]]*$//' notes.txt

# use | instead of / when the text contains slashes
$ sed 's|/home/anna|/home/ben|g' paths.txt

# insert a new first line
$ sed -i '1i My shopping list' list.txt
Careful

sed -i changes the file immediately, with no undo. Run it once without -i to preview, or use -i.bak to keep a backup copy.

awk: working with columns Advanced

awk reads text line by line and splits each line into fields (columns): $1 is the first, $2 the second, and $0 the whole line. By default, columns are separated by spaces. -F, makes it split on commas instead. NR is the current line number.

# just the "item" column
$ awk -F, '{print $2}' expenses.csv

# total spent, skipping the header β†’ 33.8
$ awk -F, 'NR>1 {sum += $3} END {print sum}' expenses.csv

# average β†’ 8.45
$ awk -F, 'NR>1 {sum += $3; n++} END {print sum/n}' expenses.csv

# rows where amount is over 3
$ awk -F, 'NR>1 && $3 > 3' expenses.csv

# total per item
$ awk -F, 'NR>1 {t[$2] += $3} END {for (i in t) print i, t[i]}' expenses.csv

# how full each drive is, and where it's mounted
$ df -h | awk 'NR>1 {print $5, $6}'

# all user accounts on the system
$ awk -F: '{print $1}' /etc/passwd

# lines longer than 80 characters
$ awk 'length > 80' script.sh

# remove duplicate lines, keep the original order
$ awk '!seen[$0]++' list.txt
In plain words

An awk command is a list of "when this, do that" rules: NR>1 {sum += $3} means "for every line after the first, add column 3 to sum". END {…} runs once, after the last line. Simple CSV files work fine, but awk doesn't understand commas inside quoted values. Use LibreOffice Calc for those.

tr: swapping or deleting characters Intermediate

tr ("translate") works on single characters, not words. It only reads from a pipe or with <, never from a file name directly.

# make everything uppercase β†’ HELLO WORLD
$ echo "hello world" | tr 'a-z' 'A-Z'

# show PATH one folder per line
$ echo $PATH | tr ':' '\n'

# commas β†’ tabs
$ tr ',' '\t' < expenses.csv

# remove Windows line endings (the ^M problem)
$ tr -d '\r' < from-windows.txt > fixed.txt

# squeeze repeats β†’ "too many spaces"
$ echo "too    many     spaces" | tr -s ' '

# a random 20-character password
$ tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 20; echo
Careful

Never redirect output into the same file you're reading (tr … < file.txt > file.txt). The shell empties the file before tr reads it, and you end up with nothing. Write to a new file, then rename it. The same applies to sort, grep and awk.

dd: copying whole disks Advanced

dd copies raw data byte for byte: if= is the input file, of= the output file. It's the classic tool for writing an .iso to a USB stick or making an exact image of a drive.

Careful: read this first

dd is nicknamed "disk destroyer". It never asks "are you sure?". If you swap if and of, or type the wrong device, it overwrites that disk, including your system disk, in seconds. Always:

  1. Run lsblk before and after plugging in the USB stick, to see which name it gets (e.g. /dev/sdb).
  2. Use the whole disk (/dev/sdb), not a partition (/dev/sdb1), when writing an image.
  3. Read the command one more time before pressing Enter.

If you're unsure, use a graphical tool like Impression or balenaEtcher instead.

# 1. find your USB stick (replace sdX below with its name)
$ lsblk

# Write a Linux .iso to a USB stick (erases the stick!)
$ sudo dd if=linuxmint.iso of=/dev/sdX bs=4M status=progress oflag=sync

# Make an exact backup image of a USB stick or SD card
$ sudo dd if=/dev/sdX of=sdcard-backup.img bs=4M status=progress

# Test how fast a disk writes: create a 1 GB test file, then remove it
$ dd if=/dev/zero of=testfile bs=1M count=1024 oflag=direct status=progress
$ rm testfile

bs=4M copies in 4 MB blocks (much faster than the default), status=progress shows how far it's got, and oflag=sync makes sure everything is really written before dd finishes.

Putting them together Advanced

# The 20 biggest files and folders in your home
$ du -ah ~ 2>/dev/null | sort -rh | head -n 20

# Your 10 most-used commands
$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head

# The 5 programs using the most memory right now
$ ps aux --sort=-%mem | head -n 6

# The 10 most common words in a text
$ tr -cs '[:alpha:]' '\n' < book.txt | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -rn | head

# Find lines that appear more than once in a file
$ sort list.txt | uniq -d

# Rename every .jpeg in this folder to .jpg
$ for f in *.jpeg; do mv -- "$f" "${f%.jpeg}.jpg"; done

# Replace a word in every .txt file under this folder (make a backup first!)
$ find . -type f -name "*.txt" -exec sed -i 's/oldname/newname/g' {} +

# Which files mention "budget"? Show them newest first
$ grep -rl "budget" ~/Documents | xargs -d '\n' ls -t

# Pack your Documents into an archive with today's date in the name
$ tar -czf documents-$(date +%F).tar.gz ~/Documents

# Share the current folder with other devices on your home network (Ctrl+C to stop)
$ python3 -m http.server 8000

For the last one, open http://your-ip:8000 on your phone or another computer. (ip a shows your IP address. Your firewall may need to allow port 8000.) Anyone on the same network can see the files while it runs, so only use it at home, and only in a folder you're happy to share.

How to read a long one-liner

Build it up one piece at a time. Run du -ah ~ alone and look at the output, then add | sort -rh, then | head -n 20. Each | hands the output to the next tool. Doing it this way also helps when something doesn't work.

Small tools worth installing

All available from your package manager. See the package manager guide.

ToolWhat it doesLevel
htop / btopA friendly, colourful task manager in the terminalN
tldrShort, practical examples for commandsN
fastfetchShows a summary of your system (distro, CPU, memory) next to a logo. Popular for screenshots.N
ncduFind out what's using your disk space, interactivelyI
fzf"Fuzzy finder". After setup, it makes Ctrl+R history search much nicer.I
batLike cat, but with colours and line numbers. (On Ubuntu the command is batcat.)I
ripgrep (rg)A much faster grep for searching inside filesA
fdA simpler, faster find. (On Ubuntu the package is fd-find and the command is fdfind.)A
tmuxSplit your terminal into panes and keep sessions running after you disconnectA
shellcheckChecks your shell scripts for common mistakesA

Keeping your system healthy

A simple routine

How oftenWhat
WeeklyInstall updates. See the cheat sheet for your distro.
MonthlyCheck your backups actually work: open a few files from the backup. Remove apps you no longer use.
Before big changesTake a Timeshift snapshot (new distro version, new driver, adding a repository).
Every few monthsClean caches (sudo apt clean, flatpak uninstall --unused), check disk space with df -h, look for errors with systemctl --failed.

Update your firmware too Intermediate

Many laptops, docks and SSDs get firmware (BIOS) updates through Linux. Check in the Software app (GNOME/Fedora: Updates page; KDE Discover: Updates) or in the terminal:

$ fwupdmgr refresh
$ fwupdmgr get-updates
$ fwupdmgr update
Careful

Keep a laptop plugged in during firmware updates and don't turn it off, even if the screen goes black for a while.

Keep a Live USB in your drawer Novice

A USB stick with your distro on it is your emergency kit: it starts the computer when nothing else does, lets you rescue files, and can restore Timeshift snapshots. See Level 1.

Speed & battery

TipHowLevel
Power modeClick the battery icon or open Settings β†’ Power and choose Power Saver, Balanced or Performance.N
Fewer startup appsRemove apps you don't need from Startup Applications (Mint) or Settings β†’ Autostart (KDE).N
Lighter desktop for old PCsTry Linux Mint's XFCE edition or Lubuntu (LXQt). They need much less memory.N
Fewer browser tabs and extensionsOn most computers, the browser is by far the biggest user of memory. Check with htop or System Monitor.N
See what slows down startupsystemd-analyze blame lists the services that took longest to start.A
Battery health and usageupower -i $(upower -e | grep BAT) shows capacity and wear. sudo powertop shows what uses power.A

Staying safe

Just for fun

$ sudo apt install cowsay fortune sl    # Fedora: dnf, Arch: pacman (there, fortune is called "fortune-mod")
$ fortune | cowsay                       # a cow tells you a random quote
$ sl                                     # a steam locomotive, for when you mistype "ls"
$ fastfetch                              # show off your system