user3040487
user3040487

Reputation: 213

How to extract all command history in one file linux

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 .

Upvotes: 11

Views: 43061

Answers (2)

Milovan Tomašević
Milovan Tomašević

Reputation: 8673

$ history > history_for_print.txt

Upvotes: 4

user2445124
user2445124

Reputation:

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

Upvotes: 24

Related Questions