How to sort files in Bash.

Display contents

$ cat file.txt
bbb
aaa
ccc
kkk
uuu
ppp

Sort

$ sort file.txt
aaa
bbb
ccc
kkk
ppp
uuu

Sort in place

$ sort -o file.txt file.txt
$ cat file.txt
aaa
bbb
ccc
kkk
ppp
uuu