Fundamentals 20 min read

35 Essential Linux Commands Every Beginner Should Master

This guide provides a concise, alphabetically ordered reference of 35 core Linux (and macOS) terminal commands, complete with explanations, practical examples, and usage tips to help newcomers quickly become comfortable navigating and managing a Unix-like system.

Liangxu Linux
Liangxu Linux
Liangxu Linux
35 Essential Linux Commands Every Beginner Should Master

1. alias (Create command shortcuts)

The alias command lets you assign a short name to a longer command or command sequence, simplifying repetitive typing. Example: alias cls=clear Now typing cls clears the screen like clear. More complex aliases can include quoted command strings, such as: alias pf="ps -e | grep $1" Running pf shutter lists processes matching "shutter".

2. cat (Concatenate and display file contents)

cat

outputs a file's contents to the terminal. To view a file without risking modification, use: cat .bash_logout Pipe the output to less for easier scrolling:

cat .bashrc | less

3. cd (Change directory)

Use cd to move to another directory. Relative paths change within the current directory, while absolute paths start with /. The shortcut ~ returns you to your home directory.

4. chmod (Modify file permissions)

chmod

sets read/write/execute flags on files and directories. The symbolic mode drwxrwxr-x shows permissions for owner, group, and others.

5. chown (Change file ownership)

chown

changes a file's owner and group. Syntax requires owner:group and typically needs sudo:

sudo chown linuxmi:linux linuxmi.py

6. curl (Transfer data with URLs)

curl

is a powerful command‑line tool for downloading or uploading files over HTTP, FTP, and other protocols.

7. df (Report filesystem disk space usage)

df -h -x squashfs

shows human‑readable sizes while excluding squashfs filesystems.

8. diff (Compare files)

Show differences between two files, e.g. side‑by‑side with:

diff -y -W 70 linuxmi.py linux.py --suppress-common-lines

9. echo (Print text or variables)

Display a string or environment variables:

echo Linux迷www.linuxmi.com与您分享关于开源的新鲜事
echo $USER
echo -e "\a"

(produces a beep)

10. exit (Close the terminal or end a session)

Terminate the current shell or SSH session with exit.

11. find (Search for files and directories)

Locate files based on name, type, size, permissions, etc.

12. finger (Display user information)

Shows brief details about a user, such as last login time and home directory.

13. free (Show memory usage)

Displays RAM and swap usage; -h makes the output human‑readable.

14. grep (Search text using patterns)

Find lines matching a pattern, e.g. grep le *.py, with highlighted matches.

15. groups (List group memberships)

Shows which groups a user belongs to, e.g. groups linuxmi.

16. gzip (Compress files)

Compress a file while keeping the original with -k:

gzip -k linux.py

17. head (Show the first lines of a file)

Default shows the first 10 lines; use -n to specify a different count.

18. history (Show command history)

List previous commands; repeat a command with !<em>number</em> or !! for the most recent.

19. kill (Terminate processes)

Find a process ID with ps -e | grep shutter and then kill it:

kill 14205

20. less (View file contents interactively)

Scroll through a file or command output without editing. Use / to search forward and ? to search backward.

21. ls (List directory contents)

Basic usage ls or detailed view with ls -l.

22. man (Read manual pages)

Display a command's manual, e.g. man chown, which itself uses less for navigation.

23. mkdir (Create directories)

Create a single directory or nested directories with -p:

mkdir -p centos/linux/33

24. mv (Move or rename files)

Move a file: mv ~/code.png . or rename: mv code.png linuxmi.png.

25. passwd (Change user passwords)

Change your own password with passwd or another user's with sudo passwd linux.

26. ping (Test network connectivity)

Send ICMP packets to an address; limit attempts with -c:

ping -c 5 23.185.0.3

27. ps (Report process status)

List running processes; filter by user with -u or show all with -e.

28. pwd (Print working directory)

Displays the absolute path of the current directory.

29. shutdown (Power off or reboot the system)

Schedule a shutdown, e.g. shutdown now for immediate action, or shutdown +15 "Shutting down in 15 minutes!" to delay.

30. ssh (Secure remote login)

Connect to a remote host with ssh user@host.

31. sudo (Execute commands as root)

Prepend sudo to commands requiring elevated privileges.

32. tail (Show the last lines of a file)

Default shows the last 10 lines; use -n to change the count.

33. top (Real‑time system monitoring)

Displays CPU load, running tasks, and memory usage.

34. uname (Show system information)

Use -a for all details, -s for kernel name, -r for release, and -v for version.

35. whoami (Identify the current user)

Prints the username of the effective user.

Practicing these commands will build a solid foundation for working efficiently in a Linux or macOS terminal environment.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxShellcommand-lineUnixbasicsterminal
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.