72.1k views
3 votes
By default sort command put items in ascending order, how do we sort things in descending order?

User Lia
by
8.2k points

1 Answer

2 votes

Final answer:

To sort things in descending order using the sort command, you can use the -r option.

Step-by-step explanation:

To sort things in descending order using the sort command, you can use the -r option. This option stands for 'reverse' and it will reverse the order of the sort, putting the items in descending order instead of ascending. For example, if you have a list of numbers in a file called 'numbers.txt', you can sort them in descending order with the command:

sort -r numbers.txt

User Manolo
by
8.8k points