LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ls -1F (https://www.linuxquestions.org/questions/linux-newbie-8/ls-1f-102631/)

sutho1 10-10-2003 07:46 PM

ls -1F
 
Can anyone explain to me how ls -1F manages to display the types of files in a directory using the symbols * for an executsble / for a directory etc

Thanks sutho

187807 10-10-2003 09:58 PM

Re: ls -1F
 
Quote:

Originally posted by sutho1
Can anyone explain to me how ls -1F manages to display the types of files in a directory using the symbols * for an executsble / for a directory etc

Thanks sutho


I'm not sure what you're asking for here.

Cut-and-paste from output of: "man ls" yields,
----------------------------------------------------------
-1, --format=single-column
List one file per line. This is the default for
when standard output is not a terminal.
-----------------------------------------------------------

and,

-----------------------------------------------------------
-F, --classify, --indicator-style=classify
Append a character to each file name indicating the
file type. For regular files that are executable,
append a `*'. The file type indicators are `/' for
directories, `@' for symbolic links, `|' for FIFOs,
`=' for sockets, and nothing for regular files.
-------------------------------------------------------------

If you're really asking HOW ls determines whether to append '*' or '/' (etc) to the listing then my answer won't help you much. My guess is:

For '*'...ls probably looks at the executable flags for the file...if the user executing the "ls" command is the owner of the file or a member of the file's group (or the user is root, or the file is "world" executable) then "ls" lists the file as executable if the permissions are applicable.

For '/'...ls probably looks at the leftmost flag in the permission structure. Directories are set with a 'd' flag and, as such, ls can append the listing with '/' given the '-F' argument.

I'm seriously new at this, but I'm not sure what you're question is asking. Hence, I ask you to clarify for the more experienced people (and also open myself up for potential correction based on my assumptions presented above).

Cheers,
Bob


All times are GMT -5. The time now is 04:59 PM.