Count duplicate lines

Count how often each line repeats in a file and show the top 20.

sort file.txt | uniq -c | sort -rn | head -20

tool
linux133 commands
tags
linux

More linux commands

  • lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,UUID

    Show disks, partitions and loop devices as a tree with filesystem type, mount point and UUID.

  • blkid

    Print UUID, LABEL and TYPE for every block device.

  • mount -t ext4 /dev/sdb1 /mnt/data

    Mount an ext4 partition to /mnt/data.

  • findmnt --real

    Show real (non-virtual) mounted filesystems as a tree.

  • mount -o remount,rw /

    Remount the root filesystem as read-write, for example after a rescue boot.

all 133 linux commands