logo
Linux Essential Commands
Last Updated : 03/12/2025 17:00:21

Linux is an open-source, Unix-like operating system (OS) kernel that serves as the foundation for various operating system distributions (distros).

Linux Essential Commands


What is Linux?


Linux is an open-source, Unix-like operating system (OS) kernel that serves as the foundation for various operating system distributions (distros). It was created by Linus Torvalds in 1991 and has since become one of the most widely used OS kernels in the world.

Key Features of Linux :

  1. Open Source – The source code is freely available for modification and distribution.
  2. Multi-User & Multitasking – Multiple users can work on the system simultaneously, and it supports running multiple processes at the same time.
  3. Security & Stability – Linux is known for its strong security features and stability.
  4. Customizability – Users can modify Linux to suit their needs, with many different desktop environments (GNOME, KDE, XFCE, etc.).
  5. Command-Line Power – The Linux terminal is powerful and allows users to control nearly every aspect of the system.
  6. Lightweight & Efficient – Some Linux distributions (e.g., Alpine, Arch, and Debian) are designed to run on minimal hardware.


Popular Linux Distributions (Distros) :

  • Ubuntu – User-friendly, great for beginners.
  • Debian – Stable and reliable, often used for servers.
  • Fedora – Cutting-edge software with frequent updates.
  • Arch Linux – Lightweight and highly customizable.
  • Kali Linux – Security-focused, used for penetration testing.
  • CentOS / RHEL – Enterprise-focused, commonly used in businesses.


Where is Linux Used?

  • Servers (Web servers, cloud computing, databases)
  • Embedded Systems (Smart TVs, routers, IoT devices)
  • Supercomputers
  • Android Devices (Android is based on the Linux kernel)
  • Cybersecurity & Ethical Hacking
  • Programming & Development.

Linux Essential Commands :


Here are some essential Linux commands that every user should know:


* File and Directory Management

  • ls – List directory contents
    ls -l   # Long format
    ls -a   # Show hidden files
    
  • cd – Change directory
    cd /home/user/Documents
    
  • pwd – Print working directory
    pwd
    
  • mkdir – Create a new directory
    mkdir myfolder
    
  • rmdir – Remove an empty directory
    rmdir myfolder
    
  • rm – Remove files or directories
    rm file.txt
    rm -r myfolder  # Remove a directory and its contents
    
  • cp – Copy files or directories
    cp file.txt /destination/
    cp -r dir1/ dir2/  # Copy directories
    
  • mv – Move or rename files
    mv oldname.txt newname.txt
    mv file.txt /new/location/
    


* File Viewing and Editing

  • cat – View file contents
    cat file.txt
    
  • less – View file contents page by page
    less file.txt
    
  • head – Show the first 10 lines of a file
    head file.txt
    
  • tail – Show the last 10 lines of a file
    tail file.txt
    tail -f log.txt  # Continuously display new lines
    
  • nano – Simple text editor
    nano file.txt
    
  • vi or vim – Advanced text editor
    vi file.txt
    


* Permissions and Ownership

  • chmod – Change file permissions
    chmod 755 script.sh
    chmod u+x script.sh  # Give execute permission to the user
    
  • chown – Change file owner
    chown user:group file.txt
    


* Process and System Monitoring

  • ps – Display running processes
    ps aux
    
  • top – Show system resource usage
    top
    
  • htop – Interactive process viewer (if installed)
    htop
    
  • kill – Terminate a process
    kill PID
    kill -9 PID  # Force kill a process
    
  • df – Show disk usage
    df -h
    
  • du – Show directory size
    du -sh foldername
    


* User Management

  • whoami – Show current user
    whoami
    
  • who – Show logged-in users
    who
    
  • id – Show user ID and group ID
    id
    
  • passwd – Change user password
    passwd
    
  • su – Switch user
    su username
    
  • sudo – Run command as superuser
    sudo apt update
    


* Networking

  • ip a – Show IP addresses
    ip a
    
  • ping – Check network connectivity
    ping google.com
    
  • netstat – Show network connections (deprecated, use ss)
    netstat -tulnp
    
  • ss – Display network connections
    ss -tulnp
    
  • wget – Download files from the internet
    wget https://example.com/file.zip
    


* Package Management

For Debian-based systems (Ubuntu, Debian):

  • apt update – Update package lists
    sudo apt update
    
  • apt upgrade – Upgrade all packages
    sudo apt upgrade
    
  • apt install – Install a package
    sudo apt install package-name
    
  • apt remove – Remove a package
    sudo apt remove package-name
    

For RHEL-based systems (CentOS, Fedora):

  • yum update – Update package lists
    sudo yum update
    
  • yum install – Install a package
    sudo yum install package-name
    


* Archiving and Compression

  • tar – Create or extract compressed archives
    tar -cvf archive.tar foldername  # Create tar archive
    tar -xvf archive.tar  # Extract tar archive
    tar -czvf archive.tar.gz foldername  # Create gzipped tar archive
    tar -xzvf archive.tar.gz  # Extract gzipped tar archive
    
  • zip – Compress files into a .zip archive
    zip -r archive.zip foldername
    
  • unzip – Extract .zip files
    unzip archive.zip
    


* Searching

  • find – Search for files and directories
    find /path -name "file.txt"
    
  • grep – Search inside files
    grep "text" file.txt
    grep -r "text" /directory/
    


* System Information

  • uname -a – Show system information
  • uptime – Show system uptime
  • free -h – Show memory usage
  • history – Show command history
  • clear – Clear terminal screen.

Note : This article is only for students, for the purpose of enhancing their knowledge. This article is collected from several websites, the copyrights of this article also belong to those websites like : Newscientist, Techgig, simplilearn, scitechdaily, TechCrunch, TheVerge etc,.
Tech Articles