Tag Info

New answers tagged

1

Simply using od or hexdump should be fine since these programs avoid outputting repeated lines (or use xxd -a as above). Eg: $ truncate -s 1M test $ hexdump test 0000000 0000 0000 0000 0000 0000 0000 0000 0000 * 0100000 $ od test 0000000 000000 000000 000000 000000 000000 000000 000000 000000 * 4000000 If the drive is zeroed then the output won't be much ...


0

on my system, uniq has the option of skipping fields. history | uniq -f 1 gives me a unique listing of my history with line numbers my version: uniq (GNU coreutils) 8.15 However, this only omits concurrent duplicates, so I would actually sort the history output, then uniq it: history | sort -k 2 | uniq -f 1 | sort -n The last sort, is optional, it ...


0

You can parse .bash_history file, instead of using history command. Here's an example in awk: awk '!x[$0]++' .bash_history | nl But like @devnull's answer, you should use HISTCONTROL to avoid duplicated command and also command which start with spaces: HISTCONTROL=ignoreboth


2

You can say: history | awk '{$1=""; sub("^ ", "", $0)}1' | sort -u to get a list of unique entries in the history. However, you can also set HISTCONTROL to avoid duplicates in the history: HISTCONTROL=ignoredups:erasedups Quoting from the manual: HISTCONTROL A colon-separated list of values controlling how commands are saved on the history ...



Top 50 recent answers are included