LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-27-2005, 03:50 PM   #1
thanhVic
LQ Newbie
 
Registered: Jan 2005
Location: Canada
Distribution: Fedora3
Posts: 26

Rep: Reputation: 15
files and directories


How can I distinguish between files and directories in Unix?
Well , I just want to use "ls" to print out very files that end with "file" in a directory where I have a few directories ending with "file" too.

glad u can help,

thanks
 
Old 02-27-2005, 04:04 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
Here's one way:

find -maxdepth 1 -type f -name '*file'

or if you want the long output:

find -maxdepth 1 -type f -name '*file' -ls

Here's another:

ls -ld *file | grep -v ^d

There are probably others...

Lyle
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 03:22 PM
Copy files from different directories fiomba Linux - Software 3 02-11-2005 03:01 AM
Move certain files into different directories facets Programming 6 05-28-2004 01:20 PM
working on directories and files caesarkim Linux - Newbie 1 11-15-2003 01:51 AM
Number of files and directories ALF Linux - Software 4 06-11-2003 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:46 AM.

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
Open Source Consulting | Domain Registration