Sample Header Ad - 728x90

List files sorted numerically

229 votes
11 answers
185994 views
I have a bunch of files from log1 to log164. I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this: home:logs Home$ ls -1 | sort log1.gz log10.gz log100.gz log101.gz log102.gz log103.gz log104.gz log105.gz log106.gz ...etc What I want is home:logs Home$ ls -1 | sort log1.gz log2.gz log3.gz log4.gz log5.gz log6.gz log7.gz ...{more here} log99.gz log100.gz log101.gz log102.gz ...etc Any suggestions in what I could use to do this?
Asked by Rabiani
Mar 9, 2012, 02:18 AM
Last activity: Mar 7, 2025, 02:38 PM