Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (19 sloc) 0.463 kb
#!/usr/bin/perl
use strict;
my $history = shift // "$ENV{XDG_DATA_HOME}/zsh/history";
my $count = shift // 25;
open(my $fh, '<', $history) or print STDERR "$!" and exit(1);
chomp(my @records = <$fh>);
close($fh);
my %commands = ();
for(@records) {
s/^:\s+[0-9]+:[0-9]+;//;
$commands{$_}++;
}
for(sort { $commands{$b} <=> $commands{$a} } keys(%commands)) {
if($count == 0) {
exit(0);
}
printf("% 5d => %s\n", $commands{$_}, $_);
$count--;
}
Jump to Line
Something went wrong with that request. Please try again.