linux guide

25+ Basic Linux Commands Every Beginner Should Know

Himanshu Pal

Himanshu Pal

25+ Basic Linux Commands Every Beginner Should Know

25+ Essential Linux Commands Every Beginner Should Know

Introduction

Linux powers most of the world’s servers, cloud platforms, and even Android devices. If you’re starting your journey with Linux, mastering basic commands is the first step. This guide covers 25+ essential Linux commands with practical examples, so you can confidently navigate the terminal.


1. File & Directory Management

pwd – Print Working Directory

Shows your current location in the filesystem.

pwd
# Output: /home/username

ls – List Files and Directories

Displays files and folders in the current directory.

ls -l   # Detailed view
ls -a   # Show hidden files

cd – Change Directory

Move between directories.

cd /etc
cd ..   # Go back one level

mkdir – Create Directory

mkdir projects

rmdir – Remove Empty Directory

rmdir old_folder

rm – Remove Files/Directories

rm file.txt
rm -r folder_name   # Delete a directory and its contents

cp – Copy Files/Directories

cp file.txt backup.txt
cp -r dir1 dir2

mv – Move or Rename Files

mv old.txt new.txt
mv file.txt /home/user/Documents/

touch – Create Empty Files

touch notes.txt

cat – View File Contents

cat file.txt

2. File Viewing & Editing

nano – Simple Text Editor

nano file.txt

less – View Large Files Page by Page

less logfile.txt

head – View First Lines of a File

head -n 10 file.txt

tail – View Last Lines of a File

tail -n 10 file.txt
tail -f /var/log/syslog   # Monitor logs in real-time

3. System Info & Navigation

whoami – Show Current User

whoami

uname – System Information

uname -a   # Kernel, architecture, OS info

df – Disk Usage

df -h   # Human-readable format

du – Directory Size

du -sh /home/user/

top – Monitor Processes

top

(Tip: Install htop for a better interface.)


4. User & Permission Management

sudo – Run Commands as Root

sudo apt update

chmod – Change File Permissions

chmod 755 script.sh

chown – Change File Ownership

sudo chown user:user file.txt

5. Networking & Package Management

ping – Test Connectivity

ping google.com

curl – Fetch Data from URL

curl https://example.com

wget – Download Files

wget https://example.com/file.zip

apt – Debian/Ubuntu Package Manager

sudo apt update && sudo apt upgrade
sudo apt install nginx

yum / dnf – CentOS/RHEL Package Manager

sudo dnf install httpd

6. Searching & Finding

grep – Search Text in Files

grep "error" logfile.txt

find – Locate Files

find /home -name "*.txt"

which – Find Command Location

which python3

7. Bonus Tips

  • Use Tab completion to save typing.

  • Use history to see previous commands:

    history
  • Use pipes (|) and redirection (>, >>):

    ls -l | grep "config" > results.txt

Conclusion

These 25+ Linux commands form the foundation of working with the terminal. As you practice, you’ll discover endless ways to combine them for powerful workflows. Bookmark this guide as a reference and start exploring Linux with confidence.