Open In App

How to Monitor Linux Commands Executed by System Users in Real-time?

If you are a Linux system administrator then you would definitely want to monitor the interactive activity of all system users, like monitoring the Linux commands they execute in real-time. In this brief Linux system security article, we will be going to discuss how to monitor all Linux shell commands executed by system users in real-time.

Let’s see how to Monitor Linux Commands Executed by System Users in Real-time:

If your current shell is Bash Shell then all the commands that are executed by normal system users will be stored in the .bash_history hidden file which is found in each user’s home directory. The content of that file can be viewed by users, using the history command.

So if we want to view a user’s (suppose tithi user ).bash_history file we have to type the following command in the terminal:-

cat /home/tithi/.bash_history 


All the commands list

And if your current shell is Zsh shell use the following command:-

cat /home/tithi/.zsh_history 

Note: use exec zsh to switch from bash shell to zsh  and exec bash for vice-versa 

Article Tags :