Javatpoint Logo
Javatpoint Logo

Linux sort

The 'sort' command sorts the file content in an alphabetical order.

Syntax:

Example:

Linux Sort Filters1

Look at the above snapshot, the 'sort' command has sorted the file 'weeks.txt' in alphabetical order.


To Sort A Column

If a file has more than one column, column number is used to sort a specific column.

Syntax:

Example:

Linux Sort Filters2

Look at the above snapshot, we have sorted column 1 and 2.


Numeric Sorting

Numeric sorting is different from alphabetical sorting. For numeric sorting option 'n' is used along with the column number if required.

Syntax:

Example:

Linux Sort Filters3
Next TopicLinux gzip





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA