where is the last commands file

When using the command line as root in Debian I get last commands executed as root. Where are those saved, what is the default file path and how can I find it?

thanks


Solution 1:

If you're using bash (default shell in Debian) you can see all your recent history in the file ~/.bash_history (so .bash_history file in your local user)

Also from the command line you can type history and it'll also show you all your recent command history

Solution 2:

The file you want is: /root/.bash_history

Solution 3:

What others have said about .bash_history is right and proper, but it won't pick up commands executed as root with sudo. Those will be in the individual users' ~/.bash_history files (or other files, if they use other shells than bash).

Solution 4:

Executing command with space in front, wont store command in history also.