6
I'm a Linux newbie trying to learn how piping works in the Ubuntu terminal. I tried to sort by file size:
ls -al | sort -k5
The files were listed in this order:
drwx------ 19 min10 domain users 0 2010-10-07 12:38 .
drwx------ 29 min10 domain users 0 2010-02-16 22:30 MSI
drwx------ 2 min10 domain users 0 2009-11-25 19:53 www
drwx------ 2 min10 domain users 0 2010-02-05 09:14 .cache
drwx------ 2 min10 domain users 0 2010-03-02 08:11 My Pictures
drwx------ 2 min10 domain users 0 2010-03-02 10:41 regu
drwx------ 2 min10 domain users 0 2010-03-31 13:08 elec
drwx------ 2 min10 domain users 0 2010-04-10 21:43 temp
drwx------ 2 min10 domain users 0 2010-10-06 09:13 bubbla
drwx------ 3 min10 domain users 0 2010-01-26 08:26 cfg
drwx------ 3 min10 domain users 0 2010-03-30 15:34 data
drwx------ 3 min10 domain users 0 2010-03-30 16:03 idv
drwx------ 3 min10 domain users 0 2010-04-01 09:10 arduino-0018
drwx------ 3 min10 domain users 0 2010-04-14 15:10 processing-1.1
drwx------ 3 min10 domain users 0 2010-07-06 16:20 eclipse
drwx------ 4 min10 domain users 0 2010-04-15 09:34 pryl
drwx------ 4 min10 domain users 0 2010-07-06 16:30 dv2
-rwx------ 1 min10 domain users 123 2010-10-07 12:38 starwars.txt
-rwx------ 1 min10 domain users 16109 2010-10-06 07:01 .bash_history
-rwx------ 1 min10 domain users 454656 2010-03-30 15:29 putty.exe
-rwx------ 1 min10 domain users 504 2010-04-10 21:16 little.gif
-rwx------ 1 min10 domain users 56682 2010-04-10 21:12 awesome.jpg
-rwx------ 1 min10 domain users 7 2010-04-10 21:32 blah.txt
This is obviously a fail in terms of sorting by file size. I tried with a bunch of other columns in addition to -k5, and repeatedly get muddled, out of order, results. I also tried -nk5, and still no go. What am I doing wrong?
ls -al | sort -k5works for me, could you edit in the output ofls -al– Nifle – 2010-10-07T13:03:46.980Okay, I made the output complete. Thanks for your response. – mindy – 2010-10-07T13:34:25.333