Top 10 Linux Commands: ls/cd/cat/grep & More

Linux has hundreds of commands, but in daily use you'll really only need 20–30. Master the 10 most frequent ones and you can handle almost all file operations, searching, and general tasks. This article walks through the 10 commands every beginner should learn first, complete with real examples.

Overview of all 10 commands

Top 10 Commands in Action (real terminal examples) $ is the input prompt. Green = input, white = output. $ pwd # show current location /home/student $ ls -la # detailed list including hidden files drwx-- 5 student 4096 .config homework/ notes.md $ cd homework && mkdir math # navigate then create a folder $ cp report.md math/ # copy to the math folder $ cat report.md # show file contents # Math report (10/30) $ grep "TODO" *.md # search all .md files for TODO notes.md: TODO: study range for next quiz $ find . -name "*.html" # find all .html files recursively ./blog/2026-05-04.html $ tail -f /var/log/syslog # watch log in real time $ man grep # official command manual
Fig. 1: Real terminal workflow: pwd → ls → cd → mkdir → cp → cat → grep → find → tail → man.

Quick reference for all 10

① pwd (Print Working Directory): displays the full path of your current location. Type it first whenever you wonder "wait, where am I?"

② ls (List): lists the files in your current folder. ls -l for details; ls -a to include hidden files. Combining them as ls -la is the classic combo.

③ cd (Change Directory): navigates to another folder. cd .. goes up one level; cd ~ goes to your home directory; cd / goes to the root (the very top).

④ mkdir / rm: create and delete folders respectively. mkdir test creates a folder called test; rm file.txt deletes a file; to delete a folder and everything inside, use rm -r foldername.

⑤ cp / mv: copy and move. cp a.txt b.txt copies a.txt under the name b.txt; mv a.txt newfolder/ moves it. Renaming is also done with mv.

⑥ cat: prints a file's contents to the screen. Good for short files. For long ones, use less — scroll with arrow keys and press q to quit.

⑦ head / tail: shows the first 10 lines (head) or last 10 lines (tail) of a file. tail -f logfile watches a log in real time — heavily used in server management.

⑧ grep: searches for a string inside files. grep "error" log.txt extracts only the lines in log.txt that contain "error." One of the most-used commands in real-world work.

⑨ find: locates files by name or criteria. find . -name "*.html" lists all HTML files under the current directory.

⑩ man (Manual): displays the official documentation for a command. man ls shows every option for ls. When in doubt, check man first.

Piping commands together

Piping (|) to Chain Commands — Real Example Pass the output of one command as the input to the next. 10 minutes of manual work becomes 1 second. $ cat access.log | grep "ERROR" | grep "2026-05-04" | wc -l 42 # ← result: 42 errors yesterday What's happening inside the pipe (4 steps) cat access.log output all 100k lines grep "ERROR" keep only error lines → 1,500 lines grep "2026-05-04" filter by date → 42 lines wc -l count lines → 42 What doing it manually looks like: Open 100k-line log in Excel (5 min) → set auto-filter → count rows visually → total: 15 minutes
Fig. 2: 4 commands chained → "100k lines → error count" in 1 second. The gap is 15 minutes vs. 1 second.

The real power of Linux commands lies in the | (pipe) — the output of one command feeds directly into the next. Chain 3–4 commands together and you can write "extract yesterday's errors from 100 log files and count them" in a single line.

When practicing, start with "viewing" commands rather than deletion or moving — it's safer. Confirm your location with pwd, see what's there with ls, read files with cat or head. Work up to cp, then mv, and leave rm for last. That order minimises the chance of irreversible mistakes.

With pipes too, preview the output first. For example, try grep "error" app.log | head to see just the top lines — once you confirm the right lines are showing, then count them. Commands are fast, so mistakes also hit fast; "confirm then execute" is the rule.

Pitfalls to watch out for

Watch out when using these 10 commands
  • Never type commands like rm -rf / — that deletes the entire OS.
  • With cp or mv, if a file of the same name already exists, it's overwritten without warning. Use the -i flag to prompt for confirmation.
  • grep is case-sensitive by default. Add -i if you want a case-insensitive search.

How will this help you in the future?

These 10 commands are exactly what engineers use every single day — web engineers, server admins, data scientists, machine learning engineers, all of them. Learn them in middle or high school and you'll walk into university information-systems courses already knowing the material.

The real value of knowing commands isn't about memorisation — it's about being able to find information yourself when things go wrong. File missing, error in the log, disk full, permissions denied. People who can extract the information they need by themselves have a big advantage. These 10 basic commands are the entry point to that skill.

Things you can do today

Get started in 3 steps
  1. Open a terminal and run pwd, ls -la, and cd Documents in order.
  2. Create a test folder with mkdir test, enter it with cd test, and create a file with echo "hello" > a.txt.
  3. Check its contents with cat a.txt, search with grep "hello" a.txt, and delete with rm a.txt to experience the full cycle.

Summary

Just 10 Linux commands cover most everyday tasks. Think in four groups: location commands (pwd, ls, cd), file operations (mkdir, cp, mv, rm), content viewing (cat, less), and search (grep, find). Pipe them together with | and they become dramatically more powerful — and directly relevant to real engineering work.