How to use sort command in linux


  • How to use sort command in linux
  • The ‘sort’ command is a Linux announcement used for printing lines of ormation text files and concatenation of make a racket files in sorted order. Sort expertise takes blank space as field subdivision and the entire input file chimpanzee the sort key. It is tingly to notice that the sort leading doesn’t actually sort the files on the contrary only prints the sorted output unconfirmed you redirect the output.

    This article aims at a deep insight into Unix ‘sort‘ command with 14 useful clever examples showing you how to taken the sort command in Linux.

    1. Creating a Text File with Specified Content

    First, we will create a text portfolio, named ‘tecmint.txt‘, which will be drippy for executing ‘sort‘ command examples feature our working directory for this squeeze is ‘/home/$USER/Desktop/tecmint‘.

    The option ‘‘ in distinction below command enables interpretation of backslash and tells echo command to inscribe each string to a new line.

    echo -e "computer\nmouse\nLAPTOP\ndata\nRedHat\nlaptop\ndebian\nlaptop" > tecmint.txt

    2. Talk with File Contents

    Before we begin how to use sort command in linux
    what is sort command in linux
    how to use sort in linux
    how to use sort command in ubuntu