How to extract all command history in one file linux
Asked Answered
G

2

11

I know how History command works in linux and also that it only displays the commands typed from terminal from that very directory in which the history command was executed,,Isn't it?My intent is to display all the commands typed(History) by me (as a user per se) .

Thanks in advance .

Garrote answered 30/11, 2013 at 7:19 Comment(2)
That is already available in one file i.e. ~/.bash_history by defaultPewee
Everything there is to know about this is in man history.Tingey
A
24

You can use the

history

command, it displays all the history, and is not taking into consideration the 'very directory in which the history command was executed'.

You can output it to a file by using

history >> file.txt

To see more about the history command, you can visit

http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x1712.htm

Amboise answered 30/11, 2013 at 7:24 Comment(1)
well,,i guess no it doesn't help :/ or maybe the command i am looking for is atleast 5 days old ! .. let me do a fresh example to it now and i ll let you know .Garrote
B
4

$ history > history_for_print.txt

Berkman answered 28/5, 2020 at 16:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.