Friday, August 5, 2011

ls command


-l list files one line at a time
-A lists all the contents of a directory except for current directory and parent directory
-B ignore backups
-c sort by change time
-d lists file and directory names without contents
-e lists all times in full
-f list without sorting
-k list file size in kilobytes
-l list files in long format
-L list files by symbolic link
-m list files horizontally separate by commas
-r sort files in reverse order
-R list files recursively
-S list files by size, biggest first
-u sort files by the last time they were accessed
-x print in columns, sorted horizontally
-X sort files alphabetically by file extension

Tuesday, August 2, 2011

Sort directory in linux

To sort directory based on size, here is the command

du -hs * | sort +0n

To view only the Gb,

du -hs * | sort +0n | grep Gb