# Use sort command input_text | sort # or input_text | sort -r # For reverse
$ sort inputfile.txt > filename.txt $ sort -o filename.txt inputfile.txt