Commands-2

Sort

Sorts lines of text files by default, non-numeric.

sort - sort lines of text files

Reverse Order

sort -r file

Numeric Sort

sort -n file

Sort By Month

Month format: Jan, Feb, Mar.

sort -M file

Specify Column

Default is separated by (consecutive) spaces or tabs.

sort -k 1 file

Specify Delimiter And Column

-k index starts from 1, the 3rd column is the user ID.

sort -t ':' -k 3 -n /etc/passwd

Ignore Case

sort -f file

Remove Duplicates

sort -u file

Alias

sort - sort lines of text files

Possible Aliases

alias -p

Type

External/Internal Command

Can view if a command is an internal command, internal commands are compiled into the shell, different from external commands, no subprocess execution is required.

type cd
cd is a shell builtin

type ps
ps is hashed (/usr/bin/ps)

All Implementations

type -a echo
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo

Command Aliases

type ll
ll is aliased to `ls -alF'

type -a ls
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
ls is /bin/ls
readlink - print resolved symbolic links or canonical file names

No need to look one by one.

readlink -f /bin/vim
/usr/bin/vim.basic