I'm using a Macbook Pro running El Capitan v 10.11.6. I am learning about symlinks, and in the
man ln page, I found the following:
A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link.
As a test, I created a symlink to a file (in another filesystem, if it matters), as follows:
ln -s /Volumes/foobardir/foobarfile foobarlink
Then I ran
lstat foobarlink to get information on the symlink file itself, but I got the following output:
-bash: lstat: command not found
which lstat returns nothing, which confirms that there is no executable with this name in my filepath.
I am able to execute
stat foobarlink, but I am not sure if the returned stats are for the linked file or the symlink itself. I do see today's date in timestamp form among the output for that command, while running
stat foobarfile shows a date from a few months ago. So I'm guessing this is the output I'm looking for, but I'd like a 2nd opinion.
By the way, running
which stat returns
grep in the
/usr/bin directory for all executables with
stat in their name returns the following:
As I stated above, my guess is that
stat returns the output that I had expected
lstat to return. My questions are:
- why is
lstatapparently not installed in my system, when
lstatas a valid command?
- Why include manual information for an executable you don't ship with?
brew search lstatreturns no results. Is it possible to install
lstatto my local machine somehow, and are there even any advantages to doing so?