How can I find out who executed a particular command and which terminal was used to run it?
how can i know particular cmd is executed by whom and to know about my terminal
To see what commands are being executed you use "ps -ef". This will tell you what everyone is doing though which is usually too much information.
To narrow it down to find out who is running a particular command you might add a "grep" filter like so:
This will return all scp commands but it might also return the grep command looking for scp and any other commands with the letters scp embedded in them since grep is just matching the string. So you may need to get clever with the expression given to grep (a lot of times you just need to quote it and add a space:
or even better leverage regular expressions and:
If you know the user and just want to know what they are running then "ps -fu" is your friend. For instance
Which can, of course, be combined with grep to get tom's scp processes:
Column 6 is the tty.
You can use
For the latter part of your question,