The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
to get the timestamp of files from the files and folders in Unix kishan HP-UX 2 04-09-2008 05:20 AM
decompressed files to specific folders c00kie88 Shell Programming and Scripting 3 04-06-2008 02:41 PM
Looking for Large Files and Folders bbbngowc Shell Programming and Scripting 8 04-02-2008 10:09 AM
list only files or folders jagnikam Shell Programming and Scripting 6 01-18-2008 06:59 AM
removing old files except configuration files and folders jamcalicut Shell Programming and Scripting 1 11-09-2007 12:34 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Stumble this Post!
How to Differentiate Between Files and Folders?

Hi All,

I'm a rookie using HPUX and I know this is going to sound like a bonehead question, but when I list the contents of a directory, how can I determine which objects are files and which are folders? I'm using the ll and ls commands to lists the contents. So far I've been determining the object types by trying to cd/more the objects and see what happens. I figured there's gotta be a better way.

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Stumble this Post!
If it's 96 bytes, it's a directory?

I think I just figured it out. Anything that's a directory seems to be 96 bytes. Does this sound like a reliable method?

Thanks,

Dan
Reply With Quote
  #3 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Stumble this Post!
Sorry for the wasted post...

drwxr-x---

If it startes with "dr"

Thanks if you were thinking about responding.
Reply With Quote
  #4 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
Stumble this Post!
Half right , if it starts with a 'd' it's a directory (the r is the start of the permissions and shows that the file owner can read the file - use "man ls" for lots of info on all of the fields displayed by ls)

cheers
Reply With Quote
  #5 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Mar 2006
Posts: 106
Stumble this Post!
here...

It is completely legitimate question BTW.

In the head of output by ls -l

- stands for a regular file
d stands for directory
l stands for a symbolic link
c stands for character oriented device
b stands for block oriented device

You can figure out more by using "man ls" command.
Get "UNIX Essentials and UNIX Core" DVD course or "UNIX in 24 hours" book as them address questions of this sort.
Hope it helps.
Reply With Quote
  #6 (permalink)  
Old 04-27-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Stumble this Post!
Thanks!

Thanks for all the replies. I'll look into those resources.
Reply With Quote
  #7 (permalink)  
Old 04-28-2006
Registered User
 

Join Date: Oct 2002
Posts: 670
Stumble this Post!
Here another visual way to represent folders and other objects, such as links. Us e the -F option of ls.

Quote:
/usr/bin/ls
-F Marks directories with a trailing slash (/), doors
with a trailing greater-than sign (>), executable
files with a trailing asterisk (*), FIFOs with a
trailing vertical bar (|), symbolic links with a
trailing "at" sign (@), and AF_UNIX address family
sockets with a trailing equals sign (=). Follows
symlinks named as operands.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0