Most Used Linux Commands

Understand the architecture

Linux is an open-source UNIX-based operating system. The main component of the Linux operating system is Linux kernel. It is developed to provide low-cost or free operating system service to personal system users.

Like any operating system, Linux consists of software, computer programs, documentation, and hardware.

  • Hardware: This is the physical layer comprising the actual devices such as the CPU, memory, storage, and I/O devices. It provides the fundamental resources required for system operation.

  • Kernel: The core of the operating system, the kernel directly interacts with the hardware. It manages system resources like CPU scheduling, memory allocation, device management, and system security. It acts as a bridge between hardware and software.

  • Shell: The shell serves as the interface between the user and the kernel. It interprets user commands and translates them into actions for the kernel. Shells can be command-line interfaces (e.g., Bash) or graphical (GUI-based).

  • Utilities: These are essential tools and programs that perform common tasks like file manipulation, process management, and system monitoring. They enhance functionality and make the system more user-friendly.

  • Applications: Applications are the topmost layer where end-users operate. They include user-specific software like web browsers, text editors, and media players. These applications rely on the underlying layers to function efficiently.

Working with Commands

1. File System Commands

These commands primarily deal with files, directories, and their properties.

  • pwd
    Purpose: Prints the current working directory path.

  • ls, ls -a, ls -l, ls -R
    Purpose: Lists files and directories in various formats.

  • cd
    Purpose: Changes the current directory.

  • mkdir
    Purpose: Creates new directories.

  • touch
    Purpose: Creates empty files or updates timestamps.

  • cp
    Purpose: Copies files or directories.

  • mv
    Purpose: Moves or renames files or directories.

  • rm
    Purpose: Deletes files or directories.

  • chmod
    Purpose: Changes file permissions.

  • chown
    Purpose: Changes the owner of files or directories.

  • find
    Purpose: Searches for files or directories based on various criteria.

  • locate
    Purpose: Quickly finds files by name.

  • zip / unzip
    Purpose: Compresses and extracts .zip files.

  • diff
    Purpose: Compares two files line by line.

  • df
    Purpose: Displays disk space usage.


2. I/O (Input/Output) Commands

These commands handle data interaction, such as file viewing, text processing, and device communication.

  • cat
    Purpose: Displays the content of files.

  • head
    Purpose: Displays the first few lines of a file.

  • tail
    Purpose: Displays the last few lines of a file.

  • echo
    Purpose: Prints text or writes it to a file.

  • grep
    Purpose: Searches for patterns in files.

  • sort
    Purpose: Sorts lines in a file or output.

  • wget
    Purpose: Downloads files from the internet.

  • ping
    Purpose: Tests network connectivity to a host.

  • free
    Purpose: Displays memory usage information.


3. Process Commands

These commands manage system processes and their states.

  • ps
    Purpose: Displays running processes.

  • top
    Purpose: Displays real-time system processes and resource usage.

  • history
    Purpose: Lists previously executed commands.

  • sudo
    Purpose: Executes commands with superuser privileges.

  • uname
    Purpose: Displays system information.

Facts : There are 20,323,379 lines of code in the Linux kernel as of 2018. That might sound like a lot but it’s actually the smallest the kernel has been for some time! Even so, despite the recent reductions, the huge line count means Linux remains the single largest open source project on the planet.

Dream.Achieve.Repeat