How to extract all command history in one file linux

user3040487 picture user3040487 · Nov 30, 2013 · Viewed 28.7k times · Source

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 .

Answer

user2445124 picture user2445124 · Nov 30, 2013

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