ls has an option to append a character after file name to indicate the file type, actually, there are three ways to enable the feature:
- -F
- --classify
- --indicator-style=classify
There are seven file types, -classify can indicate as show in the table below.
symbol | meaning |
---|---|
none | regular file |
* | executable regular file |
/ | directory |
@ | symbolic link |
| | FIFO |
= | socket |
> | door |
For files are created by:
touch file executable-file chmod executalbe-file ln -s file symbolic-link mkdir directory mkfifo fifo
If we list it with socket file created by tmux using -F option to list, we will see something like the following output:
$ ls -1d -F ./* /tmp/tmux-*/* ./directory/ ./executable-file* ./fifo| ./file ./symbolic-link@ /tmp/tmux-1000/default=
With long format -l, they looks like, owner and group ain’t listed:
$ ls -logd -F ./* /tmp/tmux-*/* drwxr-xr-x 2 40 Mar 27 15:37 ./directory/ -rwxr-xr-x 1 0 Mar 27 15:38 ./executable-file* prw-r--r-- 1 0 Mar 27 15:38 ./fifo| -rw-r--r-- 1 0 Mar 27 15:37 ./file lrwxrwxrwx 1 4 Mar 27 15:38 ./symbolic-link -> file srwxrwx--- 1 0 Mar 27 07:51 /tmp/tmux-1000/default=
The symbolic-link is the only one doesn’t keep the tailing indicator, it shows which file it links to, instead.
As for the last file type, doors, I honestly have no idea what it is and what it actually does, but it should result in an output like:
Drw--r--r-- 1 876 Mar 27 15:40 door>
I’ve known this option for really long time, but never actually used it, and still don’t. Why? As you can see from long format output, the information that classify indicator trying to display is already in the first part, the file type is right before file mode bits.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.