10 Essential Linux Commands Every Developer Should Know
A quick tour of the commands you will hit daily. Short, sharp, and copy paste ready.
1. ls — List Files
List directory contents. Add -l
for long format and -a
to show hidden files.
ls -la /var/www
2. cd — Change Directory
Move around the filesystem like a ninja in socks.
cd /etc/nginx
3. pwd — Print Working Directory
Lost? Ask the shell where you are.
pwd
4. mkdir — Make Directories
Create directories. Use -p
to build nested parents.
mkdir -p projects/cli-tools/src
5. cp — Copy Files
Copy files or directories. Use -r
for recursive copies and -i
to prompt before overwrite.
cp -ri config.example.json config.json
6. mv — Move or Rename
Move things around or rename them when they have an identity crisis.
mv old.log archive/old-$(date +%F).log
7. rm — Remove Files
Deletes files. Use with care. For directories, add -r
. Consider trash-cli
for safer deletes.
rm -r build/
8. cat — Concatenate and Print
View file contents. For large files try less
instead.
cat /etc/os-release
9. grep — Search Text
Filter lines that match a pattern. Case insensitive with -i
, recursive with -R
.
grep -Ri "error" /var/log
10. find — Find Files
Locate files by name, type, size and more. The hero of CommandLineQuiz.
find /home -type f -name "*.sh" -mtime -7
Bonus: man — Manual Pages
When in doubt, read the manual. It is friendlier than it looks.
man grep