How To Install Sort On Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

How To Install Sort On Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

sort

Sort lines of text files.

Maintainer: Michael Stone



Section: utils

Install sort

  • Debian apt-get install coreutils Click to copy
  • Ubuntu apt-get install coreutils Click to copy
  • Alpine OS apk add coreutils Click to copy
  • Arch Linux pacman -S coreutils Click to copy
  • Kali Linux apt-get install coreutils Click to copy
  • CentOS yum install coreutils Click to copy
  • Fedora dnf install coreutils Click to copy
  • Raspbian apt-get install coreutils Click to copy
  • macOS brew install coreutils Click to copy

Sort lines of text files.

How to use sort?

Below are few example commands for sort that you can use in the terminal.

Sort a file in ascending order:
sort filenameClick to copy
Sort a file in descending order:
sort -r filenameClick to copy
Sort a file in case-insensitive way:
sort --ignore-case filenameClick to copy
Sort a file using numeric rather than alphabetic order:
sort -n filenameClick to copy
Sort the passwd file by the 3rd field, numerically:
sort -t: -k 3n /etc/passwdClick to copy
Sort a file preserving only unique lines:
sort -u filenameClick to copy
Sort human-readable numbers (in this case the 5th field of `ls -lh`):
ls -lh | sort -h -k 5Click to copy
To install the latest version of sort in your favorite operating system just copy the sort installation command from above and paste it into terminal. It will download and install the latest version of sort 2026 package in your OS.