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:-
All the commands list
And if your current shell is Zsh shell use the following command:-
Note: use exec zsh to switch from bash shell to zsh and exec bash for vice-versa
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!