Bash provides several useful shortcuts that can enhance your command-line efficiency. Here are some common ones:
-
~(Tilde): Represents the home directory of the current user.- Example:
cd ~navigates to your home directory.
- Example:
-
.(Dot): Refers to the current directory.- Example:
./script.shruns a script in the current directory.
- Example:
-
..(Double Dot): Refers to the parent directory.- Example:
cd ..moves up one directory level.
- Example:
-
-(Dash): Refers to the previous directory you were in.- Example:
cd -switches back to the last directory.
- Example:
-
Ctrl + A: Moves the cursor to the beginning of the line. -
Ctrl + E: Moves the cursor to the end of the line. -
Ctrl + U: Deletes everything from the cursor to the beginning of the line. -
Ctrl + K: Deletes everything from the cursor to the end of the line. -
Ctrl + R: Initiates a reverse search through command history. -
Tab: Autocompletes file and directory names.
These shortcuts can significantly speed up your workflow in the terminal. If you want to learn more about Bash or specific commands, feel free to ask!
