1.8 KiB
1.8 KiB
CLI Folder Navigation Cheat Sheet
Basic Navigation Commands
-
View your current directory (where you are):
pwdPrints the working directory.
-
List files and folders in the current directory:
ls- Use
ls -lfor detailed info. - Use
ls -ato include hidden files.
- Use
Moving Between Folders
-
Change directory (move into a folder):
cd foldernameReplace
foldernamewith the name of the folder you want to enter. -
Go back to the parent directory (up one level):
cd .. -
Jump to the root directory:
cd / -
Jump directly to your home directory:
cd ~ -
Go back to the previous directory (where you were before):
cd -
Quick Tips for Efficient Navigation
-
Use tab completion:
- Press
Tabto auto-complete folder or file names.
- Press
-
Combine commands to jump up multiple levels:
- Up two levels:
cd ../.. - Up three levels:
cd ../../..
- Up two levels:
-
Absolute paths vs. relative paths:
- Absolute path: Starts from the root directory (e.g.,
/home/user/documents):cd /home/user/documents - Relative path: Starts from your current directory:
cd documents
- Absolute path: Starts from the root directory (e.g.,
-
Using wildcards:
- Navigate with patterns (e.g., folders starting with a specific letter):
cd a*
- Navigate with patterns (e.g., folders starting with a specific letter):
-
Check available folders and their hierarchy:
- Install and use the
treecommand:tree
- Install and use the
Bonus Commands
-
Find a file or folder:
find . -name "filename"Replace
"filename"with the name of the file or folder you're looking for. -
Print directory structure visually (if
treeis available):tree