Linux File System and Basic Commands Overview

  • File System Overview

    • The file system in Linux is similar to Windows, where C drive contains various folders and files.
    • In Linux, the root directory is represented by /, which contains all files and directories.
    • The bin directory is crucial as it contains basic executable commands.
  • Understanding Directories

    • Directories in Linux are the equivalent of folders in other operating systems, but the term "directories" is preferred for command clarity.
    • Important directories include:
    • /bin: stores basic commands (e.g. ls, cd)
    • /etc: contains configuration files (e.g. Zoom configuration)
    • /home: contains personal directories for users
    • /sbin: holds system administration commands
  • Basic Commands

    • ls Command: Lists files and directories in the current directory.
    • Variants: ls -l (detailed output), ls -a (list hidden files)
    • cd Command: Changes the current directory. Use cd .. to move one level up.
    • pwd Command: Prints the current working directory.
    • mkdir Command: Creates a new directory.
    • rmdir Command: Removes an empty directory; cannot remove non-empty directories.
    • rm Command: Removes files or directories, can be dangerous if used without caution.
    • cp Command: Copies files, can rename them in the process.
    • mv Command: Moves (or renames) files.
    • touch Command: Creates a new empty file.
    • chmod Command: Changes file permissions (e.g., add or remove execute permissions).
  • Advanced Commands

    • sudo & su: Gain administrative privileges; sudo runs a command with root privileges without switching users.
    • cat Command: Displays file contents in the terminal.
    • nano Editor: A terminal-based text editor for creating or editing files.
    • apt-get Commands:
    • apt-get update: Updates the package list.
    • apt-get upgrade: Upgrades installed packages.
    • apt-get install <package>: Installs a new package.
    • apt-get remove <package>: Uninstalls a package.
  • Safety and Best Practices

    • Be cautious with rm and rmdir to avoid accidental data loss.
    • Use rm -rf with extreme caution as it can recursively delete all contents, including root directories if misused.
    • Practice using commands often to build "muscle memory" for faster navigation and command execution.
  • Shortcuts and Efficiency in Terminal

    • Control Shortcuts:
    • Ctrl + L: Clears the terminal screen.
    • Ctrl + Shift + C/V: For copying and pasting text in the terminal.
    • Use the arrow keys to navigate command history.
    • tab: Auto-completes commands or files when partially typed.
  • Practical Approach

    • Emphasize practice by performing file operations entirely through the terminal without a mouse.
    • Create a habit of checking your current directory with pwd, listing files with ls, and experimenting with command combinations.
    • Encourage continuous learning and practice for Linux proficiency.