mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
Utilities/ls: Add an option to print raw inode numbers
This is only possible if listing an entire directory, because the LibC readdir function will return the raw inode number in each struct dirent, therefore allowing to print it as well.
This commit is contained in:
parent
93ef955597
commit
29fb3a1a60
2 changed files with 58 additions and 15 deletions
|
@ -27,6 +27,7 @@ If no *path* argument is provided the current working directory is used.
|
|||
* `-r`, `--reverse`: Reverse sort order
|
||||
* `-G`: Use pretty colors
|
||||
* `-i`, `--inode`: Show inode ids
|
||||
* `-I`, `--raw-inode`: Show raw inode ids if possible (see Notes to understand when this will not work)
|
||||
* `-n`, `--numeric-uid-gid`: In long format, display numeric UID/GID
|
||||
* `-o`, In long format, do not show group information
|
||||
* `-h`, `--human-readable`: Print human-readable sizes
|
||||
|
@ -54,5 +55,15 @@ $ ls /etc
|
|||
$ ls -la /etc
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
Printing raw inode numbers is only possible when listing an entire directory.
|
||||
This happens because the program uses the LibC `readdir` function, which
|
||||
will provide the raw inode numbers as they're appearing "on disk".
|
||||
In other cases, when strictly using the LibC `lstat` function the kernel
|
||||
will resolve the inode number with respect to the mount table, so if there
|
||||
is a mounted filesystem on a directory entry, `lstat` will give the root
|
||||
inode number for that filesystem.
|
||||
|
||||
## See also
|
||||
* [`tree`(1)](help://man/1/tree) to show the contents of the directory and subdirectories in a tree visualization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue