There are a few different ways you can find out which commands have been run on your Linux server:
Use the history
command: The history
command displays a list of the commands that have been run in the current terminal session. To view the history, simply type history
at the command prompt.
Check the system log files: Many Linux systems have log files that track system activity, including the commands that have been run. For example, on a system using the systemd
init system, you can use the journalctl
command to view the system log files.
Use the last
command: The last
command shows a list of users who have recently logged in to the system, along with the commands that they ran during their session. To view the last
command output, type last
at the command prompt.
Use the ps
command: The ps
command shows a list of the processes currently running on the system. To see a list of the commands that are currently running, use the ps aux
command. This will show a list of all processes, along with the command that started each process.
By using these techniques, you can get a good idea of which commands have been run on your Linux server. Note that these methods may not capture all commands that have been run, as some commands may not be logged or may have been run in a different terminal session.