I can cd /usr/
, but why doesn't ls -a
or ls -d
or ls -d */
show me that the usr
directory is there?
I have already seen this question, but ls -d */
yields ls: cannot access */: No such file or directory
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityYou would see the usr
directory if your current directory is /
. Your home directory, abbreviated as ~
, is probably not the root directory but something like /home/adam
.
When you call cd /usr
, you’re using an absolute path, as indicated by the leading slash. This call behaves the same wherever you execute it from.
When you call cd usr
, you tell cd
to change into the usr
directory that is in the current working directory. Because it’s relative, it behaves differently for every directory.
ls -a
(and friends) without further arguments (or arguments lacking a leading slash) also work relative to the current working directory.
You can see your current working directory’s full path with the pwd
command.