Introduction to Shell Commands

Introduction to Shell Commands

The command-line interface (CLI) is a powerful tool for interacting with your computer's operating system. Whether you're a beginner or an experienced user, mastering essential shell commands can significantly enhance your productivity and efficiency. In this guide, we'll explore a comprehensive list of essential shell commands that every user should know.

0. System Information

  1. uname: Print system information

    uname -a   # All information
  2. df: Display disk space usage

    df -h   # Human-readable format
  3. top: Display Linux processes

  4. sudo command: to run any command as super user

    sudo command

1. Navigation Commands

  1. cd: Change directory

    cd directory_name
  2. pwd: Print current working directory

  3. ls: List directory contents

    ls -l   # Detailed list
    ls -a   # Show hidden files
  4. mkdir: Make Directory

    mkdir new_directory
  5. rmdir: Remove Directory

    rmdir directory_to_remove

2. Managing files

  1. touch: Create Empty File

    touch new_file.txt
  2. cp: Copy Files and Directories

    cp file1.txt file2.txt
  3. mv: Move/Rename Files and Directories

    mv file1.txt new_directory/file1.txt
    mv old_name.txt new_name.txt
  4. rm: Remove Files and Directories

    rm unwanted_file.txt

3. Viewing and Editing Files

  1. cat: Display File Content

    cat file.txt
  2. more: Paginate Through File Content

    more file.txt
  3. less: View File Content with Navigation

    less file.txt
  4. nano/vi: Simple Text Editor

    nano file.txt
    vi file.txt

4. Process Management

  1. ps: List Running Processes

  2. kill: Terminate a Process

    kill process_id

5. Networking

  1. ping: test the reachability of a host on Internet

    ping hostname
  2. ifconfig/ip: Display network configuration

    ip addr show
  3. ssh: Securely connect to a remote server

    ssh username@hostname