Re: is there a name for the directory that is one lower that…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: rusty carruth via PLUG-discuss
Date:  
To: Main PLUG discussion list
CC: rusty carruth
Subject: Re: is there a name for the directory that is one lower that the docroot?
Ok, possible nit pick time. From the point of the filesystem (assuming
ext2/3/4/etc) ALL directories have a 'parent', if you define 'parent'
to mean where you end up when you say 'cd ..'. Even '/' has a 'parent'
- itself!

For example, on my laptop:

rusty@rusty-Alienware-17-R4:~$ ls -al / |head -3
total 18260668
drwxr-xr-x  27 root  root         4096 Jan  5 17:39 .
drwxr-xr-x  27 root  root         4096 Jan  5 17:39 ..
rusty@rusty-Alienware-17-R4:~$ 
rusty@rusty-Alienware-17-R4:~$ cd /
rusty@rusty-Alienware-17-R4:/$ pwd
/
rusty@rusty-Alienware-17-R4:/$ cd .. ; pwd
/
rusty@rusty-Alienware-17-R4:/$ 


So even / has a parent directory (as defined by '..') - itself. Side
note - I worked someplace where they used this as a feature, sort of.
They wanted to 'look up' the directory tree for a certain directory
(without using find ;-), so their $PATH had something like
'../bin:../../bin:../../../bin:../../../../bin:../../../../../bin' in
it, so that they would 'find' the bin dir that was 'closest' upward -
and if they happened to be somewhere that one of those '../' hit '/',
it wouldn't cause an error since there is always a directory 'above'
every directory.

On Tue, 2025-01-07 at 15:00 -0700, David Schwartz via PLUG-discuss
wrote:
>
> (Every folder except ‘/‘ has a “parent directory”.)


---------------------------------------------------
PLUG-discuss mailing list:
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss