DEV Community

Sreekanth Kuruba
Sreekanth Kuruba

Posted on • Edited on

10 Essential Linux Commands Every Beginner Must Know

Most beginners don’t struggle with Linux because it’s hard.

They struggle because they try to learn everything at once.

The truth is simple:

You only need a small set of commands to start working confidently in Linux, DevOps, and cloud environments.

In this post, you’ll learn 10 essential Linux commands that are used every day on real servers.

If you understand these, Linux will finally start to “click”.


What You’ll Learn in 5 Minutes

By the end of this post, you will know how to:

Navigate files and folders
Create, copy, move, and delete files
View file contents
Understand basic system interaction

These are the exact commands used in real DevOps workflows.


Before We Start (Important Mindset Shift)

Think of Linux like your smartphone.

Android/iOS → Linux OS
Apps → Programs
Settings → System configuration
Storage → Linux folders
Permissions popup → File permissions
Restart phone → System reboot

You don’t “see” the system — you just use it.

That’s exactly how Linux works.


1. ls — List Files and Directories

ls
ls -l     # Detailed list (permissions, size, date)
ls -a     # Show hidden files
ls -la    # Most commonly used combination
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used daily to check files, permissions, and directory contents.


2. cd — Change Directory

cd /home/user/documents
cd ..     # Go back one directory
cd ~      # Go to home directory
cd -      # Go to previous directory
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to navigate between directories in servers and systems.


3. pwd — Print Working Directory

pwd
Enter fullscreen mode Exit fullscreen mode

Shows your current location in the filesystem.

Real-world usage:
Used to verify current working path.


4. mkdir — Make Directory

mkdir myfolder
mkdir -p dir1/dir2/dir3   # Create nested directories
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to create project folders or directory structures.


5. rm — Remove Files or Directories

⚠️ Dangerous command — can delete everything permanently if misused.

rm file.txt
rm -r foldername          # Remove directory
rm -rf foldername         # Force remove (very dangerous)
rmdir foldername          # To remove only an empty directory
Enter fullscreen mode Exit fullscreen mode

Safer alternative with confirmation:

rm -ri foldername
Enter fullscreen mode Exit fullscreen mode
  • -i asks before deleting each file.

Tip: Always use ls first before deleting anything.
Tip: In Linux, there is no recycle bin in most servers. Deleted files are usually gone permanently.

Real-world usage:
Used to delete unwanted files or clean up space.


6. cp — Copy Files and Directories

cp file.txt file_backup.txt
cp -r folder1 folder2     # Copy folder
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used for backups before modifying files.


7. mv — Move or Rename Files

mv file.txt /home/user/docs/
mv oldname.txt newname.txt   # Rename file
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to move logs, configs, or rename files.


8. cat — View File Content

cat filename.txt
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to quickly view file contents like logs and configuration files.


9. touch — Create Empty File

touch newfile.txt
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to create log or config files.


10. echo — Print Text / Write to File

echo "Hello World"
echo "Hello Linux" > file.txt     # Create/overwrite file
echo "New line" >> file.txt       # Append to file
Enter fullscreen mode Exit fullscreen mode

Real-world usage:
Used to write data into files or test outputs.


Beginner Basics (Highly Recommended)

What is a Terminal?

The terminal is a text-based interface used to interact with the Linux operating system using commands.


Basic Command Structure

Most Linux commands follow this format:

command [options] [arguments]
Enter fullscreen mode Exit fullscreen mode

Example

ls -la /home/user
Enter fullscreen mode Exit fullscreen mode
  • ls → command
  • -la → options
  • /home/user → argument

Linux is Case-Sensitive

Linux treats uppercase and lowercase differently.

file.txt
FILE.txt
Enter fullscreen mode Exit fullscreen mode

These are considered two different files.


Paths in Linux

Absolute Path

Starts from the root directory.

cd /home/user/documents
Enter fullscreen mode Exit fullscreen mode

Relative Path

Starts from your current location.

cd documents
Enter fullscreen mode Exit fullscreen mode

Useful Beginner Commands

man ls       # Show manual for any command
ls --help   # Quick help
whoami       # Show current logged-in user
id           # Shows user and group IDs
uname -a    # Display system information
history      # Show previously used commands
Enter fullscreen mode Exit fullscreen mode

Keyboard Shortcuts Every Beginner Should Know

Ctrl + C     # Stop a running command
Ctrl + Z     # Pause/suspend a running process
Enter fullscreen mode Exit fullscreen mode

Bonus: sudo — Run Commands as Administrator

sudo apt update
sudo mkdir /newfolder
sudo chown user:group file.txt
Enter fullscreen mode Exit fullscreen mode
  • sudo stands for “SuperUser DO” and runs commands with admin (root) privileges.
  • Gives you temporary admin rights
  • You will use it very often for installing packages and editing system files

Warning: Use sudo only when necessary.


Why These Commands Matter

These commands form the foundation of working with Linux.

Almost every advanced Linux task — DevOps, cloud computing, scripting, server management — builds on these basics.


Summary

You learned:

  • Navigation → ls, cd, pwd
  • File Management → mkdir, cp, mv, rm, touch
  • File Content → cat, echo
  • Administrator access → sudo
  • System & User Info -> whoami, id, uname -a, history

Next Steps:

After mastering these basics, next learn:
Linux File System Explained Simply,(/, /home, /etc, /var, etc.)

Top comments (0)