Is it possible to find out the history of recently typed in commands of a particular user in a multi user system?
the history command expects a numeric argument with it. is it possible to find out the history o commands of a particular user say John_smith for example?
# ./justdoit test
test USER ".sh_history" HISTORY FILE(s)
=========================================
1 /bin/bash
2 bash
3 exit
4 ls -l bash
5 ls -l /bin/bash
6 exit
7 bash
8 exit
9 bash
10 exit
#!/bin/bash
## justdoit simple users history view script unix.com @ygemici
user=$1
for i in `find "/home/$user" -name "*history" 2>/dev/null`
do
echo $i|sed 's|.*/\(.*\)/.*$|\1 USER "'$(echo "${i##/*/}")'" HISTORY FILE(s)|'
echo "=========================================";sleep 1
strings -a $i|cat -n|more -d;echo;sleep 2
done