From BBMap suite.
$ kmercountexact.sh Written by Brian Bushnell Last modified November 29, 2018 Description: Counts the number of unique kmers in a file. Generates a kmer frequency histogram and genome size estimate (in peaks output), and prints a file containing all kmers and their counts. Supports K=1 to infinity, though not all values are allowed. SEE ALSO: bbnorm.sh/khist.sh loglog.sh, and kmercountmulti.sh. Usage: kmercountexact.sh in=<file> khist=<file> peaks=<file> Input may be fasta or fastq, compressed or uncompressed. Output may be stdout or a file. out, khist, and peaks are optional.
$ kmercountmulti.sh Written by Brian Bushnell Last modified December 30, 2016 Description: Estimates cardinality of unique kmers in sequence data. Processes multiple kmer lengths simultaneously to produce a histogram. Usage: kmercountmulti.sh in=<file> sweep=<20,100,8> out=<histogram output>