34 Most Useful Linux System Commands You Need To Know - howsnip

34 Most Useful Linux System Commands You Need To Know

Did you know the Linux command line has been empowering users to interact with their systems for decades? Many Linux commands, like ls, cd, cp, and rm, trace their roots back to the original Unix systems of the 1970s, making them both powerful and time-tested tools.

Whether you’re a newcomer or an experienced user, working efficiently with Linux often means mastering the command line. This guide introduces a curated set of essential commands that help you manage files, directories, processes, networks, and your overall Linux system.

System administrators and developers heavily rely on these commands to automate tasks, manage users, monitor system health, and securely transfer files, making the command line an essential part of day-to-day work.

  1. uname -a
  2. uname -r
  3. uptime
  4. hostname
  5. hostname -i
  6. last reboot
  7. date
  8. cal
  9. w
  10. whoami
  11. finger user
  12. ls
  13. pwd
  14. cd
  15. mkdir
  16. rmdir
  17. rm
  18. cp
  19. mv
  20. cat
  21. touch
  22. clear
  23. ps
  24. man
  25. grep
  26. echo
  27. wget
  28. df
  29. top / htop
  30. kill
  31. find
  32. chmod
  33. ping
  34. history

1. uname -a

This command shows comprehensive system information including the kernel name, hostname, kernel version, hardware architecture, and operating system details. This command helps you quickly get an overview of your Linux environment.

Command: uname -a

uname command with -a option - howsnip

2. uname -r

If you want to check exactly which kernel your system is running, then you can use the following command:

Command: uname -r

uname command with -r option - howsnip

3. uptime

This command tells you how long the system has been running since the last reboot, the current time, how many users are logged in, and the system load averages for the past 1, 5, and 15 minutes.

Command: uptime

uptime command - howsnip

4. hostname

This command prints the network name of your computer, which identifies your machine on a network.

Command: hostname

hostname command - howsnip

5. hostname -i

In case if you just want to display the IP address linked to your hostname, then the command is:

Command: hostname -i

hostname command with -i option - howsnip

6. last reboot

This command lists system reboot history with dates and times. It shows when the system was restarted and can help in diagnosing unexpected restarts or server uptime.

Command: last reboot

last reboot - howsnip

7. date

This command displays the current date and time according to the system clock.

Command: date

date command - howsnip

8. cal

This command shows a simple text calendar of the current month.

Command: cal

cal command - howsnip

9. w

This command lists users currently logged in along with what command or process they are running. It also shows login time, idle time, and CPU usage, providing a snapshot of user activity.

Command: w

w command - howsnip

10. whoami

This command prints your current username to confirm which user account you’re operating under and is useful when working with multiple users or privileges.

Command: whoami

whoami command - howsnip

11. finger user

This command displays detailed information about a specified user, such as their full name, home directory, shell type, and whether they are logged in etc.

Command: finger root

finger command - howsnip

12. ls

This command lists files and directories in the current folder. It can be combined with options to show details like permissions, sizes, and modification dates.

Command: ls

ls command - howsnip

13. pwd

This pwd command shows the full path of your current location in the filesystem, useful to confirm where you are before running relative file commands.

Command: pwd

pwd command - howsnip

14. cd

This command changes the current directory to another. It helps you navigate the filesystem.

Command: cd /path

cd command - howsnip

15. mkdir

This command creates a new directory (folder).

Command: mkdir <directory_name>

mkdir command - howsnip

16. rmdir

To remove an empty directory, you can use the following command:

Command: rmdir <directory_name>

If a directory contains files, you need other commands like rm with options to delete it.

rmdir command - howsnip

17. rm

This command deletes files or directories (with options). Be cautious with this command because deleted files often cannot be recovered.

Command: rm -rf <file_name>

rm command - howsnip

18. cp

This command copies files or directories from one location to another.

Command: cp <from_filename> <to_filename>

cp command - howsnip

19. mv

This command moves or renames files and directories which is useful for organizing or renaming files without duplicating data.

Command: mv <from_filename> <to_filename>

move command - howsnip

20. cat

This command displays the contents of a file in the terminal.

Command: cat <file_name>

cat command - howsnip

21. touch

This command creates an empty file or updates the timestamp on an existing file.

Command: touch <filename>

touch command - howsnip

22. clear

This command clears the terminal screen to provide a clean workspace without previous command outputs cluttering the view.

Command: clear

clear command - howsnip

23. ps

This command shows the current running processes for the user or system. This helps to monitor what programs are active at a given time.

Command: ps
Command: ps -aux

ps command - howsnip

24. man

This command opens the “manual” pages for any command, giving you detailed descriptions, usage options, and examples for nearly all Linux commands.

Command: man <command>

man command - howsnip

25. grep

This command searches text or command outputs for specific patterns or keywords.

Command: cat <file_name> | grep "text"

grep command - howsnip

26. echo

This command prints text or variable values to the terminal which is used in scripts to display messages or output.

Command: echo "Text" >> <filename>

echo command - howsnip

27. wget

This command downloads files or pages from the internet directly from the command line.

Command: wget <url>

wget command - howsnip

28. df

This command displays disk space usage for all mounted filesystems, showing total, used, and available space.

Command: df -h

df command - howsnip

29. top / htop

This command displays a live, dynamic view of running tasks, CPU, memory usage, and other system resources.

Command: top

`htop` is a more user-friendly alternative to `top` with navigation features.

top command - howsnip

30. kill

This command stops a running process by its process ID (PID) and is useful for shutting down unresponsive or unwanted tasks.

Command: kill -9 <pid>

kill command - howsnip

31. find

This command searches for files or directories matching specific criteria like name patterns, file size, or modification date.

Command: find . -name "filename"

find command - howsnip

32. chmod

This command changes permissions of files or directories, controlling who can read, write, or execute them.

Command: chmod +x <filename>

chmod command - howsnip

33. ping

This command tests network connectivity to another host by sending packets and measuring response time.

Command: ping <domain/ip>

ping command - howsnip

34. history

This command displays a list of commands you have recently executed.

Command: history

history command - howsnip