Begin Linux
COURSE

35 Linux commands: a beginner course

Learn navigation, text processing, permissions and system inspection through one small practice project.

On this page
  1. Before you begin
  2. Your command reference
  3. Practice: build a small report
  4. Next lesson
  5. Reference documentation

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-practice

Keep 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.

pwd

2. ls

List entries, including hidden files. The long listing shows permissions and ownership.

ls -la

3. cd

Change directory. A path beginning with / is absolute; other paths are relative. cd without an argument returns home.

cd ~/beginlinux-practice

4. mkdir

Create a directory. If it already exists, the command reports that rather than replacing it.

mkdir notes

5. touch

Create an empty file, or update the timestamp of an existing file without clearing its contents.

touch notes/draft.txt

6. printf

Write formatted text. The > operator replaces the destination contents; use it only for your practice file.

printf 'Linux\nfiles\nLinux\n' > notes/draft.txt

7. cat

Display the entire small file. For large files, use a pager instead.

cat notes/draft.txt

8. less

Read one screen at a time. Press / to search and q to leave. Some minimal installations do not include less.

less notes/draft.txt

10. tail

Read the last two lines. tail -f follows a growing file; stop following with Ctrl+C.

tail -n 2 notes/draft.txt

11. cp

Copy a file. Repeating this example replaces copy.txt, so inspect the destination first.

cp notes/draft.txt notes/copy.txt

12. mv

Rename or move a file. The destination can be overwritten; choose a new name for practice.

mv notes/copy.txt notes/review.txt

13. wc

Count lines. Without -l, wc reports lines, words and bytes.

wc -l notes/draft.txt

14. grep

Find matching lines and their line numbers. A nonzero exit status can simply mean no match.

grep -n 'Linux' notes/draft.txt

15. sort

Print sorted lines without modifying the original file.

sort notes/draft.txt

16. uniq

Remove adjacent duplicate lines. Sorting first groups repeated lines together.

sort notes/draft.txt | uniq

17. cut

Extract fields using a chosen delimiter. Here the first colon-separated field is printed.

printf 'alice:reader\nbob:editor\n' | cut -d ':' -f 1

18. 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.txt

21. stat

Inspect size, ownership and timestamps. Exact formatting differs between systems.

stat notes/draft.txt

22. du

Estimate disk space used by a directory. -h prints readable units.

du -sh notes

23. 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.

id

25. whoami

Print the current effective user name; it may differ after switching accounts.

whoami

26. uname

Print the kernel release. This is not the distribution version.

uname -r

27. date

Show the system time and timezone. This example reads the clock without changing it.

date

28. 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.

top

30. sleep

Pause for two seconds. Useful for understanding foreground commands and small scripts.

sleep 2

31. chmod

Give the owner read/write permission and remove group/other permissions on this practice file only.

chmod u=rw,go= notes/draft.txt

32. 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 notes

33. man

Read the installed manual. Press q to exit. Some minimal systems omit manual pages; try ls --help instead.

man ls

34. rmdir

Remove an empty directory. It refuses to remove a directory containing files.

mkdir empty-demo
rmdir empty-demo

35. 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.txt

Practice: build a small report

  1. Show your working directory and list the notes folder.
  2. Count the lines containing Linux. Compare grep Linux notes/draft.txt | wc -l with the total line count.
  3. Make a second copy called final.txt. Read it, then inspect its permissions.
  4. 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.