LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-10-2003, 08:46 PM   #1
sutho1
LQ Newbie
 
Registered: Sep 2003
Location: Townsville Australia
Distribution: redhat 9
Posts: 10

Rep: Reputation: 0
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
 
Old 10-10-2003, 10:58 PM   #2
187807
Member
 
Registered: Oct 2003
Location: North Carolina, USA
Distribution: Slackware 11
Posts: 174

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off




All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration