Hi,
What is the command for sorting files according to their size
Thanx in advance
Hi,
What is the command for sorting files according to their size
Thanx in advance
You have to use a combination of ls and sort. Try this:
ls -l | sort -n -k5,5
or
ls -l | sort -n +4
hi,
In ls -l | sort -n -k5,5 what is -k5,5. I have to list all the files in the directory in ascending or descending order depending on their size.
Thanx in advance
Read the man page of sort to know what specific options do. -k specifies what key no. to sort on. Check the man page for details on how to sort in the ascending and descending order.
rtfm.
homework?
du -s * | sort -n