Help answer threads with 0 replies.
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 09-06-2004, 12:34 AM   #1
LQ Newbie
Registered: Sep 2004
Location: Norman, OK
Distribution: Fedora Core 2 - 2.6.8
Posts: 2

Rep: Reputation: 0
ls - show first x files in directory

Is there a way to list only the first "x" files in a directory (e.g. list the first 20 files)?
Old 09-06-2004, 12:41 AM   #2
LQ Newbie
Registered: May 2004
Location: Green Bay, WI
Distribution: RH 9 RHE 2.1 3.0
Posts: 27

Rep: Reputation: 15

ls -l | head -20

you ls -l the directory you want to see and then pipe that into a head -20 or what ever number you wish.

Hope that helps

Old 09-06-2004, 12:45 AM   #3
LQ Newbie
Registered: Sep 2004
Location: Norman, OK
Distribution: Fedora Core 2 - 2.6.8
Posts: 2

Original Poster
Rep: Reputation: 0
Talking Thanks!

Brilliant! Thanks!


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
Apache: show mp3 id tags in directory browsing? wijnands Linux - Software 1 08-09-2005 08:09 AM
Directory and files don't show in Debian jonr Debian 1 05-17-2005 01:53 AM
change profile to show current directory jpolachak Linux - Newbie 2 01-20-2005 08:36 PM
show size of all filesin a directory watashiwaotaku7 Linux - Newbie 4 09-30-2003 12:49 AM
How do I show the structur of directory with words? pelgrim Linux - Newbie 4 03-17-2003 07:30 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:38 PM.

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