5.2 Navigation
Chala, aata type karuya. Tumchya EC2 var login kara aani majhya sobat he commands chalva.
| Command | Meaning | Example |
|---|---|---|
pwd |
Print working (current) directory | pwd → /home/ubuntu |
ls |
List files | ls, ls -l, ls -la, ls -lh /var/log |
cd |
Change directory | cd /etc, cd .., cd ~, cd - |
tree |
Show folder tree (install package tree) |
tree -L 2 /etc/nginx |
clear |
Clear the screen (or press Ctrl+L) | |
history |
Previous commands | history | tail -20, then !45 to re-run no. 45 |
pwd # where am I?
ls -la # long listing including hidden files (starting with .)
cd /var/log # absolute path (starts with /)
cd ../www # relative path (.. = parent, . = current)
cd ~ # go to home directory (same as just 'cd')
cd - # go back to the previous directory
Understanding ls -l output:
-rw-r--r-- 1 ec2-user ec2-user 1024 Mar 3 10:15 notes.txt
│└──┬───┘ │ └──┬───┘ └──┬───┘ └┬─┘ └─────┬────┘ └───┬───┘
│ permissions links owner group size modified time name
└─ type: - file, d directory, l symbolic link
Keyboard shortcuts that save hours
Tab auto-completes file and command names (press twice to see options). ↑ / ↓ scroll through history. Ctrl+C stops a running command. Ctrl+R searches history. Ctrl+A / Ctrl+E jump to start / end of line.
Ravindra Bagale's Tip
Khup students pratyek naav purna type kartat aani typo mule "No such file or directory" yeto. Tab key vapra – te naav purna karto aani chukicha path asel tar complete hotach nahi, mhanje tumhala laghech kalte. Ha ek savay tumcha ardha vel vachvel.
Practice task
Starting from your home folder, go to /var/log, then to /etc/ssh, then back with cd -, then home with cd. Print the path with pwd after each step.