Is there a way to have in the .bash_history file, listed: the directory where the command has been typed, the date, and the command ?
History command showing the directory: NO! :(
History command showing the the date: YES! :)
That's because (from
So, nothing about the directory where the command has been typed.
To know the exact time certain command was executed, see
So all you have to do is to set
To have it permanently set, run the following command:
The above command will add a new line (
Now, the output of
You CAN write the current working directory in a history file as well, but you have to make an own history file:
Write your .bashrc as follows:
It's a bit circumstantial, but it works. An entry could look like this:
Can you please clear your question a bit. There is a command called fc(fixed command) in ubuntu which enables you to display the history file, edit and re-execute previous command. Basically it is the alias set up for history command.
You can also use