Learning Linux commands is essential for navigating and managing files, processes, and configurations from the command line. Here’s a guide to some fundamental commands categorized by functionality, which are widely used across various Linux distributions.

 1. File and Directory Management

- ls: Lists files and directories in the current directory.
  bash
  ls            Basic listing
  ls -l         Detailed list with file permissions, size, etc.
  ls -a         Lists all files, including hidden ones
  

- cd: Changes the current directory.
  bash
  cd /path/to/directory     Change to a specific directory
  cd ..                     Go up one level
  cd ~                      Go to the home directory
  

- pwd: Prints the current working directory.
  bash
  pwd
  

- mkdir: Creates a new directory.
  bash
  mkdir new_directory
  

- rm: Removes files or directories.
  bash
  rm file.txt              Deletes a file
  rm -r directory_name     Deletes a directory and its contents
  

- cp: Copies files or directories.
  bash
  cp file.txt /path/to/destination           Copy a file
  cp -r directory /path/to/destination       Copy a directory recursively
  

- mv: Moves or renames files or directories.
  bash
  mv file.txt /new/path            Move a file
  mv oldname.txt newname.txt       Rename a file
  

---

 2. Viewing and Editing Files

- cat: Concatenates and displays the content of files.
  bash
  cat file.txt     Display file contents
  

- less: Views the content of a file one screen at a time.
  bash
  less file.txt
  

- nano: Opens a simple text editor.
  bash
  nano file.txt     Edit a file
  

- vim or vi: Opens the Vim editor, a more advanced text editor.
  bash
  vim file.txt      Edit a file with Vim
  

 

 3. File Permissions and Ownership

- chmod: Changes file permissions.
  bash
  chmod 755 file.sh     Assigns read, write, execute permissions
  

- chown: Changes file ownership.
  bash
  chown user:group file.txt     Change ownership
  

---

 4. System Monitoring and Process Management

- ps: Lists running processes.
  bash
  ps aux        Detailed list of all processes
  

- top: Displays system resources and process activity in real time.
  bash
  top
  

- kill: Terminates a process by PID (Process ID).
  bash
  kill 1234     Kill process with ID 1234
  

- df: Shows disk space usage.
  bash
  df -h         Display usage in human-readable format
  

- free: Displays memory usage.
  bash
  free -h       Human-readable memory usage
  

---

 5. Networking Commands

- ping: Checks network connectivity to a host.
  bash
  ping example.com
  

- ifconfig: Displays network interfaces and IP configurations.
  bash
  ifconfig
  

- curl: Transfers data from or to a server (HTTP requests).
  bash
  curl http://example.com
  

- wget: Downloads files from the internet.
  bash
  wget http://example.com/file.zip
  

 

 6. Searching and Filtering

- grep: Searches for a pattern in a file or output.
  bash
  grep "pattern" file.txt     Search for 'pattern' in file.txt
  

- find: Searches for files and directories.
  bash
  find /path -name "file.txt"     Find files named 'file.txt'
  

- locate: Quickly finds the location of files by name.
  bash
  locate file.txt
  

 7. Compression and Archiving

- tar: Archives multiple files into a tarball (and can compress).
  bash
  tar -czvf archive.tar.gz /path/to/folder     Create a compressed archive
  tar -xzvf archive.tar.gz                     Extract a compressed archive
  

- zip and unzip: Compresses and decompresses files.
  bash
  zip archive.zip file1.txt file2.txt     Create a zip archive
  unzip archive.zip                       Extract a zip archive
  

 8. System and User Management

- sudo: Runs commands with superuser privileges.
  bash
  sudo command
  

- adduser: Creates a new user.
  bash
  sudo adduser username
  

- passwd: Changes the user password.
  bash
  passwd       Change password for the current user
  sudo passwd username    Change password for a specific user
  

- whoami: Displays the current logged-in user.
  bash
  whoami
  

---

 9. Package Management (For Debian-based systems like Ubuntu)

- apt update: Updates the package lists.
  bash
  sudo apt update
  

- apt upgrade: Upgrades all installed packages to their latest versions.
  bash
  sudo apt upgrade
  

- apt install: Installs a new package.
  bash
  sudo apt install package_name
  

 Getting Help in Linux based operating systems - 

- man: Displays the manual for a command (e.g., man ls).
  bash
  man ls     View documentation for the 'ls' command
  

- --help: Most commands also provide a --help option for quick usage information.
  bash
  ls --help     Display help for the 'ls' command
  

These commands cover a wide range of essential tasks, from file management and system monitoring to network troubleshooting. Getting comfortable with these will give you a solid foundation in Linux!