Basic Linux Commands – Cheat sheet

This cheat sheet covers some of the most essential commands you’ll encounter in Linux.

File Management:

  • ls: List directory contents. Use ls -l for detailed information.
  • pwd: Print your current working directory.
  • cd: Change directory. Use cd ~ to go to your home directory.
  • mkdir: Create a new directory.
  • mv: Move or rename files/directories.
  • cp: Copy files/directories.
  • rm: Delete files/directories (use with caution!).
  • touch: Create an empty file.

Basic Operations:

  • clear: Clear the terminal screen.
  • cat: Display the contents of a file.
  • echo: Print text to the terminal.
  • man: Access the manual page for a specific command (detailed help).

Permissions and Ownership:

  • chmod: Change file/directory permissions.
  • chown: Change file/directory ownership.

Network:

  • ping: Check network connectivity to a host.
  • ssh: Securely connect to a remote machine.
  • wget: Download a file from the internet.
  • curl: Transfer data to or from a server.

Process Management:

  • ps: List running processes.
  • top: Monitor system processes and resource usage.
  • kill: Terminate a process.

Finding Things:

  • grep: Search for text patterns within files.
  • find: Locate files based on name, criteria, etc.

Help and Information:

  • whoami: Show your current username.
  • exit: Exit the terminal.
  • history: Show command history.
  • man – Access manual pages for detailed command help.
  • help – Get help on specific built-in shell commands.
  • clear – Clear the terminal screen.

This is a basic list. Many more commands exist for specific tasks. Use man to explore further!