Memorize Most Useful Pacman Commands
If you’re running Arch Linux, or anything Arch-based like CachyOS, you already know that pacman
is one of the core tools you’ll use—probably daily.
But let’s be real: remembering all those -S
, -R
, -Q
, and -Syu
flags gets confusing fast. I used to look them up constantly (even for simple stuff), until I sat down and made a simple system to actually remember them.
🔧 Basic Concept: Think in Categories
Rather than memorizing every command individually, we grouped them by what we needed to do. Just like you’d do in real life:
- Install something
- Remove something
- Search for something
- Get information
- Clean things up
Turns out, pacman
follows this logic really well.
✅ Install & Update Packages
Install a package:
pacman -S <package>
🧠 Remember -S
as “Send it to me” (Sync from the repository).
Update everything (the Arch way):
pacman -Syu
🧠 Mnemonic: “Sync, refresh the repos with y, and update everything.”
You’ll use this more than anything else.
🗑️ Remove Packages (Cleanly!)
Remove a package:
pacman -R <package>
Just deletes the program—not configs or dependencies.
Full, squeaky-clean removal:
pacman -Rns <package>
🧠 Rns = Remove Neatly & Squeaky
— it deletes the package, its unused dependencies, and leftover config files. I use this when I’m done testing something.
🔍 Searching for Packages
Search available packages (online repo):
pacman -Ss <keyword>
🧠 Ss
= Search Store
Search only installed packages:
pacman -Qs <keyword>
🧠 Qs
= Query System
📄 Package Information
Get info about a package in the repo:
pacman -Si <package>
Get info about an installed package:
pacman -Qi <package>
List all files a package installed:
pacman -Ql <package>
Find out what package owns a file:
pacman -Qo /path/to/file
🧹 Cleanups & Maintenance
Arch doesn’t clean up after itself by default, so we run these occasionally:
Remove orphaned packages (leftovers):
pacman -Rns $(pacman -Qdtq)
Clean the package cache (but keep most recent):
pacman -Sc
Clean EVERYTHING in the cache:
pacman -Scc
🧠 Scc
= Super clean cache (but be careful—you’ll need to re-download packages later).
⚠️ Bonus: Troubleshooting Tools
These aren’t used often, but they’re lifesavers:
- Check missing files from installed packages:
pacman -Qk
- Mark a package as explicitly installed:
pacman -D --asexplicit <package>
- Mark it as a dependency instead:
pacman -D --asdeps <package>
🧠 Trick to Memorize Them All
- We grouped all commands by action. Just ask yourself: Am I installing? Searching? Cleaning?
- Made up little mnemonics:
Syu
= “Sync Your Universe”Rns
= “Remove Neatly & Squeaky”Ss
= “Search Store”Qi
= “Query Installed”
- Typed them often. Practice helps way more than reading.
📌 Final Cheat Sheet
Here’s a quick reference:
Action | Command | Reminder |
---|---|---|
Install | pacman -S <pkg> | Sync |
Update system | pacman -Syu | Sync Your Updates |
Remove | pacman -R <pkg> | Remove |
Remove clean | pacman -Rns <pkg> | Neat & Squeaky |
Search repo | pacman -Ss <name> | Search Store |
Search installed | pacman -Qs <name> | Query System |
Info (repo) | pacman -Si <pkg> | Show Info |
Info (installed) | pacman -Qi <pkg> | Query Installed |
Files by pkg | pacman -Ql <pkg> | Query List |
Who owns file | pacman -Qo /file | Query Owner |
Remove orphans | pacman -Rns $(pacman -Qdtq) | Clean Deps |
Clean cache | pacman -Sc | Soft Clean |
Clean ALL | pacman -Scc | Super Clean |
Post Comment