Display Top 5 Lines From Unix Command Output

1.1k Views Asked by At

I am trying to display only the first 5 or so lines of Unix command xxd file/path.dmg similarly to the head() command in r.

As of now, I am simply trying to spam "ctrl + c" to halt execution as fast as possible, but unsurprisingly I'm not fast enough. I'm aware of the term "pipping" and I'd imagine this method could be useful. I might get arthritis if I don't find a solution soon.

1

There are 1 best solutions below

0
On

xxd file/path.dmg | head -n [# of lines] will do the trick.

You can additionally use xxd file/path.dmg | head -n [# of lines] > output.txt to save the results to a text file! :)