Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-27-2005, 03:50 PM   #1
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,

Old 02-27-2005, 04:04 PM   #2
Registered: Jul 2003
Distribution: Slackware
Posts: 389

Rep: Reputation: 52
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...



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

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

All times are GMT -5. The time now is 11:53 AM.

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