Linux Print History Command Without Line Numbers

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-history-command-without-line-numbers/
PINTEREST
PINTEREST
INSTAGRAM

Linux history command is used to get previously used commands by the current user. Default size for the history command is 1000 which means that last 1000 command will be stored in the history.

While listing history of bash line numbers are provided too. This is not expected in some situations. To get history without line numbers following commands can be used.

Printing .bash_history File

The simplest and easiest way is printing .bbash_history file. History file stored commands in a plain format.

Using Awk

With awk following command can be used to filter with substring.

Using Awk

Using Awk

Using Sed

We can use sed stream line editor to filter line numbers we will remove all numbers from start of the each line up to a space in this example.

Using Sed

Using Sed

Using Cut

Cut is simplest example of the removing history line numbers. We will delimit output according to space and print columns start with 2 and others.

Using Cut

Using Cut

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-history-command-without-line-numbers/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  What is File System Block And Super Block?

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)