Bash – How to do the `history` command and not have line numbers so I can copy multiple line commands

bashcommand historycommand line

Sometimes I do the history command so I can see 4 commands in a row.

I want to copy those commands so I can run them again.

I usually select them with the mouse and shift-ctrl-c which works ok, but I also get the line numbers.

How can I do history and not have line numbers?

I tried the man page but was overwhelmed.

Best Answer

Using awk:

history | awk '{$1="";print}'

Related Question