Linux Command Line Cheat Sheet
A quick reference guide to essential Linux commands for navigation, file management, searching, permissions, and basic Bash scripting. Master these commands to efficiently manage your system.
Core Principles
- Understand command syntax: `command [options] [arguments]`.
- Use `man command` for detailed help.
- Piping (`|`) connects command outputs to inputs.
- Redirection (`>`, `>>`, `<`) controls input/output.
- Permissions (read, write, execute) control file access.
Action Steps
- Practice creating directories with `mkdir` and `mkdir -p`.
- Navigate using `cd`, `cd ..`, and `cd ~`.
- List files with `ls -l` and `ls -la`.
- Create files using `touch` or `cat >`.
- Copy (`cp`), move (`mv`), and delete (`rm`, `rm -r`) files/directories.
- Search for text within files using `grep` with various options.
- Find files based on name, size, or type using `find`.
- Manage file permissions with `chmod` (octal and symbolic).
- Use `ln` for hard and symbolic links.
- Implement basic scripting logic with `read`, `echo`, and `if` statements.
Key Terms
- pwd: Print Working Directory: Shows the current absolute path.
- ls: List: Displays directory contents.
- cd: Change Directory: Navigates between directories.
- grep: Global Regular Expression Print: Searches for patterns in text.
- find: Searches for files and directories within a directory hierarchy.
- chmod: Change Mode: Modifies file permissions.
- man: Manual: Displays the manual page for a command.
- pipe (|): Connects the standard output of one command to the standard input of another.
- redirection (>): Redirects standard output to a file, overwriting it.
- umask: User file-creation mode mask: Sets default permissions for new files/directories.