Create foldersfiles.md
This commit is contained in:
@@ -0,0 +1,100 @@
|
|||||||
|
# CLI Folder Navigation Cheat Sheet
|
||||||
|
|
||||||
|
## Basic Navigation Commands
|
||||||
|
|
||||||
|
1. View your current directory (where you are):
|
||||||
|
```
|
||||||
|
pwd
|
||||||
|
```
|
||||||
|
*Prints the working directory.*
|
||||||
|
|
||||||
|
2. List files and folders in the current directory:
|
||||||
|
```
|
||||||
|
ls
|
||||||
|
```
|
||||||
|
- Use `ls -l` for detailed info.
|
||||||
|
- Use `ls -a` to include hidden files.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Moving Between Folders
|
||||||
|
|
||||||
|
1. Change directory (move into a folder):
|
||||||
|
```
|
||||||
|
cd foldername
|
||||||
|
```
|
||||||
|
*Replace `foldername` with the name of the folder you want to enter.*
|
||||||
|
|
||||||
|
2. Go back to the parent directory (up one level):
|
||||||
|
```
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Jump to the root directory:
|
||||||
|
```
|
||||||
|
cd /
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Jump directly to your home directory:
|
||||||
|
```
|
||||||
|
cd ~
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Go back to the previous directory (where you were before):
|
||||||
|
```
|
||||||
|
cd -
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Tips for Efficient Navigation
|
||||||
|
|
||||||
|
1. Use tab completion:
|
||||||
|
- Press `Tab` to auto-complete folder or file names.
|
||||||
|
|
||||||
|
2. Combine commands to jump up multiple levels:
|
||||||
|
- Up two levels:
|
||||||
|
```
|
||||||
|
cd ../..
|
||||||
|
```
|
||||||
|
- Up three levels:
|
||||||
|
```
|
||||||
|
cd ../../..
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 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
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Using wildcards:
|
||||||
|
- Navigate with patterns (e.g., folders starting with a specific letter):
|
||||||
|
```
|
||||||
|
cd a*
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Check available folders and their hierarchy:
|
||||||
|
- Install and use the `tree` command:
|
||||||
|
```
|
||||||
|
tree
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 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 `tree` is available):
|
||||||
|
```
|
||||||
|
tree
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user