What is the opposite of the root directory in a path?
What do you call the opposite of the root directory in a file path, for instance:
/home/stephenm/somedir/
How would you refer to the directory
/somedir/
in a generic way and it is not the PWD does it have a certain name?
Solution 1:
The last segment of a path is usually called the tail
. The earliest use of the term that I know of was by Bill Joy in An Introduction to the C shell, page USD4:28, where he described the C shell's :t
tail operator.
Solution 2:
I don't think there is a well-known and unambiguous single-word for that.
You can call it the local name of the file's directory.
You can call it the basename of the directory path.
You could argue that a directory is never more than a single element of a path and therefore it is the local directory
You could adopt the idea mentioned in Graham's comment and call it a leaf directory
Whatever you do is likely to need some accompanying explanation or example.