30 Essential Linux Commands Every Beginner Should Know

30 Essential Linux Commands Every Beginner Should Know

The Linux terminal is one of the most powerful tools available to Linux users.

Instead of relying only on graphical applications, you can use commands to navigate the file system, manage files, install software, monitor the system, troubleshoot networks, and administer servers.

If you’re learning Linux, you don’t need to memorize hundreds of commands. Start with the most useful ones and practice them regularly.

In this guide, we’ll look at 30 essential Linux commands that every beginner should know.


1. pwd — Show Your Current Directory

pwd stands for Print Working Directory.

It shows your current location in the Linux file system.

pwd

Example:

/home/yourname

2. ls — List Files

ls displays files and directories.

ls

For more detailed information:

ls -l

To show hidden files:

ls -la

3. cd — Change Directory

Use cd to move between directories.

cd Documents

Go back to the previous directory:

cd ..

Go directly to your home directory:

cd ~

4. mkdir — Create a Directory

Create a new folder with:

mkdir projects

You can create multiple directories:

mkdir linux networking cybersecurity

5. touch — Create a File

Create an empty file:

touch example.txt

You can create several files at once:

touch file1.txt file2.txt file3.txt

6. cp — Copy Files

Copy a file:

cp example.txt backup.txt

Copy a directory and its contents:

cp -r projects projects-backup

7. mv — Move or Rename Files

Rename a file:

mv old.txt new.txt

Move a file:

mv example.txt Documents/

8. rm — Delete Files

Remove a file:

rm example.txt

Remove a directory and its contents:

rm -r projects

⚠️ Be careful with rm. Deleted files may not be recoverable through a normal recycle bin.


9. cat — Display File Contents

Display the contents of a text file:

cat example.txt

It’s useful for quickly reading configuration files and text documents.


10. less — Read Large Files

For large files, less is more convenient than cat.

less /var/log/syslog

You can scroll through the file and search its contents.

Press:

q

to exit.


File and Text Management

11. grep — Search for Text

grep searches for a specific word or pattern.

Example:

grep "error" logfile.txt

This searches for lines containing:

error

You can also search command output:

ip addr | grep inet

12. find — Find Files

Search for a file:

find /home -name "example.txt"

Search for files ending in .log:

find /var/log -name "*.log"

find is extremely useful when working with Linux servers.


13. head — Show the Beginning of a File

Display the first lines:

head example.txt

Specify the number of lines:

head -n 20 example.txt

14. tail — Show the End of a File

Display the last lines:

tail example.txt

To monitor a log file in real time:

tail -f /var/log/syslog

This is especially useful when troubleshooting services.


Permissions and Administration

15. chmod — Change Permissions

Change file permissions:

chmod +x script.sh

A common permission configuration is:

chmod 755 script.sh

Permissions determine who can read, write, or execute a file.


16. chown — Change Ownership

Change the owner of a file:

sudo chown user example.txt

Change owner and group:

sudo chown user:developers example.txt

17. sudo — Run a Command as Administrator

sudo allows authorized users to execute commands with elevated privileges.

Example:

sudo apt update

Be careful when using sudo because administrative commands can make significant changes to the system.


18. whoami — Show Current User

Find out which account you’re using:

whoami

Example output:

yourname

Software Management

19. apt — Manage Packages

Ubuntu and Debian-based systems commonly use APT.

Update package information:

sudo apt update

Install a package:

sudo apt install curl

Remove a package:

sudo apt remove curl

Upgrade packages:

sudo apt upgrade

System Information

20. df — Check Disk Space

Display available disk space:

df -h

The -h option displays sizes in a human-readable format.


21. du — Check Directory Size

Check how much space a directory uses:

du -sh Documents

This is useful when investigating storage problems.


22. free — Check Memory

Display RAM and swap usage:

free -h

23. uname — Display System Information

Show kernel information:

uname -a

This can help identify the running Linux kernel and system architecture.


Processes and Services

24. ps — View Processes

Display running processes:

ps

A more detailed view:

ps aux

25. top — Monitor Processes

Run:

top

This displays processes and resource usage in real time.

You can monitor:

  • CPU
  • Memory
  • Processes
  • System load

Press:

q

to exit.


26. systemctl — Manage Services

Check a service:

sudo systemctl status ssh

Start a service:

sudo systemctl start ssh

Restart a service:

sudo systemctl restart ssh

Stop a service:

sudo systemctl stop ssh

systemctl is an important command for Linux system administration.


Networking Commands

27. ip — Network Information

Display network interfaces:

ip addr

Display routing information:

ip route

The ip command is commonly used for Linux network troubleshooting.


28. ping — Test Connectivity

Test connectivity to another host:

ping 8.8.8.8

You can also test a domain:

ping google.com

Press:

Ctrl + C

to stop the command.


29. ss — Check Network Connections

Display listening ports:

ss -tuln

This can help identify services listening for network connections.


30. curl — Transfer Data and Test Websites

curl is commonly used to communicate with web servers.

For example:

curl https://example.com

It can also be useful for testing HTTP connectivity and APIs.


Linux Commands Cheat Sheet

Here’s a quick reference:

CommandPurpose
pwdShow current directory
lsList files
cdChange directory
mkdirCreate directory
touchCreate file
cpCopy
mvMove/rename
rmDelete
catDisplay file
lessRead large files
grepSearch text
findFind files
headShow beginning
tailShow end
chmodChange permissions
chownChange ownership
sudoRun with elevated privileges
whoamiShow current user
aptManage packages
dfDisk space
duDirectory size
freeMemory usage
unameSystem information
psProcesses
topProcess monitor
systemctlManage services
ipNetwork information
pingTest connectivity
ssNetwork connections
curlHTTP/network requests

Practice Linux Commands Safely

If you’re new to Linux, don’t experiment with important production systems.

Instead, create a Linux virtual machine using:

  • VirtualBox
  • VMware Workstation
  • Hyper-V

Ubuntu is a good choice for beginners.

You can then practice commands without risking important files on your main computer.


A Simple Linux Practice Exercise

Create a practice directory:

mkdir linux-practice

Enter it:

cd linux-practice

Create a file:

touch notes.txt

Add some text:

echo "Learning Linux" > notes.txt

Read the file:

cat notes.txt

Check its permissions:

ls -l notes.txt

Finally, check your current location:

pwd

This small exercise combines several commands from this article.


Conclusion

Learning Linux commands is one of the best ways to become comfortable with the Linux operating system.

You don’t need to memorize all 30 commands immediately. Start with navigation and file management, then gradually learn permissions, package management, system administration, and networking.

The more you practice, the more natural the Linux terminal will become.

For IT professionals, these commands are useful when working with Linux desktops, servers, cloud infrastructure, networking, and cybersecurity.


FAQ

What Linux commands should beginners learn first?

Start with pwd, ls, cd, mkdir, touch, cp, mv, and rm.

Is the Linux terminal difficult?

It can seem difficult initially, but regular practice makes it much easier.

Can I practice Linux commands without installing Linux?

Yes. You can use a virtual machine, Windows Subsystem for Linux, or another Linux environment.

What is the most important Linux command?

There isn’t one single most important command. Commands such as ls, cd, sudo, apt, systemctl, and ip are particularly useful for beginners and administrators.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top