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 07-11-2016, 08:31 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: SATX
Distribution: RHEL/CentOS
Posts: 1,166
Blog Entries: 4

Rep: Reputation: 131Reputation: 131
ls -al command has a limit to what it can files it can list?


Have a directory on a RHEL server where, if I run the following command:

Code:
[root@server adump]# ls -ltc | wc -l
37188
[root@server adump]#
It gives me a number of files in that directory.

If I run the following, to get a better idea of what files are showing up towards the bottom of the ls command.

Code:
[root@code adump]# ls -ltc | tail -n 25
-rw------- 1 oracle dba      871 Mar 11 03:46 rhnsatdb_ora_22968_1.aud
-rw-r----- 1 oracle dba      871 Mar 11 03:46 rhnsatdb_ora_23651_1.aud
-rw-r----- 1 oracle dba      870 Mar 11 03:46 rhnsatdb_ora_23739_1.aud
-rw------- 1 oracle dba      869 Mar 11 03:46 rhnsatdb_ora_24023_1.aud
-rw------- 1 oracle dba      870 Mar 11 03:46 rhnsatdb_ora_24792_1.aud
-rw-r----- 1 oracle dba      870 Mar 11 03:46 rhnsatdb_ora_25191_1.aud
-rw------- 1 oracle dba      872 Mar 11 03:46 rhnsatdb_ora_25448_1.aud
-rw------- 1 oracle dba      805 Mar 11 03:46 rhnsatdb_ora_25586_3.aud
-rw-r----- 1 oracle dba      869 Mar 11 03:46 rhnsatdb_ora_25662_2.aud
-rw-r----- 1 oracle dba      804 Mar 11 03:46 rhnsatdb_ora_26040_1.aud
-rw------- 1 oracle dba      871 Mar 11 03:46 rhnsatdb_ora_26509_1.aud
-rw------- 1 oracle dba      871 Mar 11 03:46 rhnsatdb_ora_28822_1.aud
-rw-r----- 1 oracle dba      871 Mar 11 03:46 rhnsatdb_ora_31581_1.aud
-rw------- 1 oracle dba      869 Mar 11 03:46 rhnsatdb_ora_31799_3.aud
-rw------- 1 oracle dba      865 Mar 11 03:46 rhnsatdb_ora_31943_2.aud
-rw------- 1 oracle dba      861 Mar 11 03:46 rhnsatdb_ora_32052_1.aud
-rw-r----- 1 oracle dba    17824 Mar 11 03:46 rhnsatdb_ora_32542_1.aud
-rw------- 1 oracle dba      868 Mar 11 03:46 rhnsatdb_ora_3640_1.aud
-rw-r----- 1 oracle dba      869 Mar 11 03:46 rhnsatdb_ora_4690_2.aud
-rw-r----- 1 oracle dba     5121 Mar 11 03:46 rhnsatdb_ora_696_2.aud
-rw------- 1 oracle dba      859 Mar 11 03:46 rhnsatdb_ora_7019_3.aud
-rw-r----- 1 oracle dba      801 Mar 11 03:46 rhnsatdb_ora_7758_1.aud
-rw-r----- 1 oracle dba      869 Mar 11 03:46 rhnsatdb_ora_8665_2.aud
-rw------- 1 oracle dba      867 Mar 11 03:46 rhnsatdb_ora_9810_1.aud
-rw------- 1 oracle dba      867 Mar 11 03:46 rhnsatdb_ora_9827_1.aud
[root@code adump]#

The date shows Mar 11 of 2016.

However say I run the following find command below, it brings back results that are further in the past the what is listed by then the first ls command

Code:
[root@serveradump]# find . -type f -name "*.aud" -mtime 123 -print | xargs ls -al
-rw------- 1 oracle dba     862 Mar  9 18:59 ./rhnsatdb_ora_20376_3.aud
-rw------- 1 oracle dba     862 Mar 10 02:12 ./rhnsatdb_ora_22200_1.aud
-rw------- 1 oracle dba     866 Mar 10 02:15 ./rhnsatdb_ora_23165_3.aud
-rw-r----- 1 oracle dba    1823 Mar  9 18:00 ./rhnsatdb_ora_23945_1.aud
-rw-r----- 1 oracle dba    2793 Mar  9 18:00 ./rhnsatdb_ora_23950_1.aud
-rw-r----- 1 oracle dba    1650 Mar  9 18:00 ./rhnsatdb_ora_23951_2.aud
-rw-r----- 1 oracle dba    1050 Mar  9 18:00 ./rhnsatdb_ora_23953_2.aud
-rw-r----- 1 oracle dba 3983944 Mar  9 18:08 ./rhnsatdb_ora_23954_1.aud
-rw-r----- 1 oracle dba    1650 Mar  9 18:00 ./rhnsatdb_ora_23955_4.aud
-rw-r----- 1 oracle dba    5125 Mar  9 18:08 ./rhnsatdb_ora_23956_1.aud
-rw-r----- 1 oracle dba   17824 Mar  9 18:08 ./rhnsatdb_ora_23963_2.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30671_1.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30673_1.aud
-rw------- 1 oracle dba     862 Mar 10 02:17 ./rhnsatdb_ora_30675_2.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30677_4.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30679_1.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30681_2.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30683_3.aud
-rw------- 1 oracle dba     862 Mar 10 02:16 ./rhnsatdb_ora_30693_1.aud
-rw------- 1 oracle dba     862 Mar 10 00:08 ./rhnsatdb_ora_30743_1.aud
-rw------- 1 oracle dba     862 Mar 10 02:17 ./rhnsatdb_ora_30779_1.aud
-rw------- 1 oracle dba     862 Mar  9 23:26 ./rhnsatdb_ora_31007_3.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3686_2.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3688_4.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3690_2.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3692_1.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3694_1.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3696_2.aud
-rw------- 1 oracle dba     860 Mar 10 02:15 ./rhnsatdb_ora_3698_1.aud
-rw------- 1 oracle dba     860 Mar 10 00:09 ./rhnsatdb_ora_5706_2.aud
-rw------- 1 oracle dba     858 Mar 10 00:02 ./rhnsatdb_ora_874_1.aud

So I'm wondering why the 1st ls command isn't showing me all of the 37188 files, and I have to use a find command with mtime to show files that are further back in time?

thanks
 
Old 07-11-2016, 10:18 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Code:
tail -n 25
Shows the last 25 lines
 
Old 07-11-2016, 11:17 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,929

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
In addition, the difference is due to the c option of the ls command which is ctime but your using mtime with find.
 
1 members found this post helpful.
Old 07-11-2016, 11:37 AM   #4
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: SATX
Distribution: RHEL/CentOS
Posts: 1,166
Blog Entries: 4

Original Poster
Rep: Reputation: 131Reputation: 131
Ok, I removed the 'c' from the ls and was able to get what I need.

Code:
[root@server adump]# ls -alt | tail -n 5
-rw-r----- 1 oracle dba      993 Jan  6  2011 rhnsatdb_ora_21118_1.aud
-rw-r----- 1 oracle dba      803 Jan  6  2011 rhnsatdb_ora_20869_2.aud
-rw-r----- 1 oracle dba      801 Jan  6  2011 rhnsatdb_ora_20944_1.aud
-rw-r----- 1 oracle dba      805 Jan  6  2011 rhnsatdb_ora_20869_1.aud
drwxr-x--- 6 oracle dba     4096 Jan  6  2011 ..
 
  


Reply

Tags
find command, ls command


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
[SOLVED] Is it possible to use the ls command to list files in one column? BobNutfield Slackware 23 09-21-2010 03:13 AM
Command to list files by permissions rickh Programming 5 06-20-2007 10:08 AM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 06:29 PM
Command to list some files? AoiSora Programming 13 10-29-2003 05:37 PM
Command to list total number of files. WillieB_72 Linux - General 3 01-29-2003 10:25 PM


All times are GMT -5. The time now is 10:56 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