Thursday, June 10, 2010

Sort commands

The command to sort the contents of the file is

#ls -al | sort

and to reverse the sorting order we use r at the end of the command as shown below

#ls -al | sort r

The command to sort the contents of the directory in disk usage basis is as follows

# du -s * | sort -n

and similarly to reverse the sorting order we use r at the end of the command as shown below

# du -s * | sort -nr




Source --
http://www.softpanorama.org/Tools/sort.shtml

No comments:

Post a Comment

(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })()