I've never prided myself on my knowledge of Linux - I know my way around, I reach for commands/tools (ex. grep
, jq
, etc.) that aid me in my day job. But this one felt like a particularly embarrassing TIL.
While SSHing into a Raspberry Pi I had, I needed to navigate to the var
directory.
ssh chris@bastion
I wanted to see "where I was", so I ran:
chris@bastion:~ $ ls
Weirdly, it was empty.
So I tried navigating to the directory anyway.
chris@bastion:~ $ cd /var/
chris@bastion:/var $ ls
backups cache lib local lock log mail opt run spool swap tmp www
At this, I was a bit surprised. I swear I didn't see the var
directory from where I started.
This was a result of a misunderstanding of the /
path expression.
I know ~
represents my home directory. I know ./
represents the current working directory.
But somehow I missed /
represents the root directory. I sometimes used this, but I always meant to use ./
, so usage of /
always failed.