The Warnet Desa’s server shelf: pwd, ls -la, cd, cat, mkdir -p, rm -r in a model bash held to GNU’s screens. Relative vs absolute paths, . and .., a cd that…
Why it matters
git, npm, deploys, servers: all in the terminal. "No such file or directory" when the file is there is nearly always about the working folder and relative paths. A cd that fails quietly makes the next line run in the wrong place, and rm has no recycle bin.
The key idea
The shell always stands in one working folder
Common mistakes
"file not found" when the file is there You are in the wrong working folder. Check pwd and ls first: a relative path counts from there. Or write its absolute path.
Mixing up /folder and folder A leading / = absolute (from the root). No / = relative (from the working folder). ~ = your home, .. = the parent.
rm is permanent at once The shell has no recycle bin: rm and rm -r delete for good. Check with ls first; rm -i asks before each file.
cd folder; rm -r * deletes the wrong folder When the cd fails (a typo), ; still runs rm in the old working folder. Use cd folder && rm -r *, or give rm its full path.
Try it in this playground
Type pwd then ls pwd = where you are; ls = what is there. See Piksel’s lantern on the shelf.
Go into a folder, then up with .. cd goes down a level; cd .. climbs to its parent. The steps are numbered on the shelf.
Read a file by an absolute path For example cat /etc/hosts from ~: a path starting with / is the same from anywhere.
See a failed cd leave the shell in place cd to a folder that is not there, then run another command: it runs in the old folder.