35 Linux commands: a beginner course
Learn navigation, text processing, permissions and system inspection through one small practice project.
On this page
Before you begin
Use your own Linux desktop or a disposable virtual machine. Open Terminal as your normal user. No administrator access is needed. Examples use Bash and common GNU utilities; optional utilities may be absent. Read each command before running it.
mkdir -p ~/beginlinux-practice
cd ~/beginlinux-practiceKeep this folder for the whole lesson. If it already contains important work, choose a new practice folder instead. Commands below are in learning order; later examples use files created earlier.
Your command reference
1. pwd
Print the working directory. Use this before changing files so you know where you are.
pwd2. ls
List entries, including hidden files. The long listing shows permissions and ownership.
ls -la3. cd
Change directory. A path beginning with / is absolute; other paths are relative. cd without an argument returns home.
cd ~/beginlinux-practice4. mkdir
Create a directory. If it already exists, the command reports that rather than replacing it.
mkdir notes5. touch
Create an empty file, or update the timestamp of an existing file without clearing its contents.
touch notes/draft.txt6. printf
Write formatted text. The > operator replaces the destination contents; use it only for your practice file.
printf 'Linux\nfiles\nLinux\n' > notes/draft.txt7. cat
Display the entire small file. For large files, use a pager instead.
cat notes/draft.txt8. less
Read one screen at a time. Press / to search and q to leave. Some minimal installations do not include less.
less notes/draft.txt9. head
Read the first two lines. Useful for previewing a text file before processing it.
head -n 2 notes/draft.txt10. tail
Read the last two lines. tail -f follows a growing file; stop following with Ctrl+C.
tail -n 2 notes/draft.txt11. cp
Copy a file. Repeating this example replaces copy.txt, so inspect the destination first.
cp notes/draft.txt notes/copy.txt12. mv
Rename or move a file. The destination can be overwritten; choose a new name for practice.
mv notes/copy.txt notes/review.txt13. wc
Count lines. Without -l, wc reports lines, words and bytes.
wc -l notes/draft.txt14. grep
Find matching lines and their line numbers. A nonzero exit status can simply mean no match.
grep -n 'Linux' notes/draft.txt15. sort
Print sorted lines without modifying the original file.
sort notes/draft.txt16. uniq
Remove adjacent duplicate lines. Sorting first groups repeated lines together.
sort notes/draft.txt | uniq17. cut
Extract fields using a chosen delimiter. Here the first colon-separated field is printed.
printf 'alice:reader\nbob:editor\n' | cut -d ':' -f 118. tr
Translate characters from standard input. This example changes lowercase letters to uppercase.
printf 'linux\n' | tr '[:lower:]' '[:upper:]'19. find
Search beneath notes for files with a matching name. Quote the pattern so the shell does not expand it first.
find notes -type f -name '*.txt'20. file
Describe a file type. Availability depends on the distribution; the name extension alone does not prove the format.
file notes/draft.txt21. stat
Inspect size, ownership and timestamps. Exact formatting differs between systems.
stat notes/draft.txt22. du
Estimate disk space used by a directory. -h prints readable units.
du -sh notes23. df
Show free space on the filesystem containing the current directory. This is different from a directory size.
df -h .24. id
Display your user identity and group memberships.
id25. whoami
Print the current effective user name; it may differ after switching accounts.
whoami26. uname
Print the kernel release. This is not the distribution version.
uname -r27. date
Show the system time and timezone. This example reads the clock without changing it.
date28. ps
List your processes. Columns and options vary; inspect the local help for details.
ps -u "$(whoami)"29. top
Watch processes interactively. Press q to exit. Do not stop unfamiliar processes just because they use CPU.
top30. sleep
Pause for two seconds. Useful for understanding foreground commands and small scripts.
sleep 231. chmod
Give the owner read/write permission and remove group/other permissions on this practice file only.
chmod u=rw,go= notes/draft.txt32. tar
Create a local archive. Check it with tar -tf notes-backup.tar before relying on it as a backup.
tar -cf notes-backup.tar notes33. man
Read the installed manual. Press q to exit. Some minimal systems omit manual pages; try ls --help instead.
man ls34. rmdir
Remove an empty directory. It refuses to remove a directory containing files.
mkdir empty-demo
rmdir empty-demo35. rm
Remove only the practice copy, with a confirmation prompt. Deletion does not use the desktop trash; avoid recursive force flags.
rm -i notes/review.txtPractice: build a small report
- Show your working directory and list the notes folder.
- Count the lines containing Linux. Compare
grep Linux notes/draft.txt | wc -lwith the total line count. - Make a second copy called final.txt. Read it, then inspect its permissions.
- Create an archive of notes and list the archive’s contents. Confirm final.txt appears.
Check your understanding
The original sample has three lines and two Linux matches. A pipeline sends one command’s output to the next command. Sorting does not rewrite the source unless you explicitly redirect output. An archive is useful only if you can inspect and restore it.
Next lesson
Continue with Bash essentials, filesystem basics, and users and permissions. For graphical tasks, follow the Linux desktop course.
Reference documentation
Consult the GNU Coreutils manual, Bash manual, and your installed manual pages for distribution-specific behavior.