# is there any way to find out what commands I have run so far on my terminal in the present installation of Fedora?

Is there any method to find out the history of commands run on terminal? I want to see all commands in my current installation of fedora.

edit retag close merge delete

Sort by » oldest newest most voted

The "history" command may be helpful or "~/bash_history" may provide what you need.

more

In general, you can look through your last 1000 commands by using the up and down arrows at the command prompt. (The size of your history list can be configured, but that's the default.) Once you have the command you're looking for, you can either execute it as is, or edit it and then execute. (This is very useful if you need to correct a typo in a long, involved command.) For more details on how you can use your bash history, try man history. The history command is one of the bash builtin commands, so you'll have to page down until you come to it in alphabetic order.

more

Another way - with advantage of giving the date and time of commands entered - is to use the bash DEBUG trap as a hook to log all commands entered from interactive shell to syslog or elsewhere. for example, create a file in /etc/profile.d/logcmd.sh , with:

function logcmd
{
unset PROMPT_COMMAND
if  [ -n "$BASH_COMMAND" ] && [ -n "$PS1" ]; then
logger -d -p local6.debug -t bash "${USER}[$$]: BASH_COMMAND" fi } [ -n "PS1" ] && trap logcmd DEBUG  The PS1 check prevents from logging commands from inside scripts that would flood the log. The unset PROMPT_COMMAND avoids useless output to syslog. Note: to log commands from ssh sessions, you also need to add something in bashrc, for example: if [ -n "SSH_CLIENT" ] && [ -n "BASH_EXECUTION_STRING" ]; then logger -d -p local6.debug -t bash "{USER}[$$]:$BASH_EXECUTION_STRING"
fi


more