Is it possible to use cp to copy every user's .bash_history file into the same folder (with the username appended)?
Or is it at least possible to copy them into a parallel set of folders? I can't seem to figure this out.
I do have root access.
for a in pattern loops over all items in a pattern.
Instead of echo we use the copy command. (cp)
And since we do not want to overwrite all files we either need to change the destination name, or we need to concatenate them all in one file.
To copy we use *cp $a /tmp/$a_file* (all files are now named differently.
To concattenate we can use cat with append to redirection.
Remember this is NOT a totally fool proof way to copy a users' activity. This is because there are options that the user can easily invoke to not put things in the history file. So I would not count on this as any sort of auditing mechanism.
Also, as a root user, spying on other users' file unless there are specific and valid reasons for doing so is a little suspect. Lacks a little integrity here, unless you tell them up front that you are going to do this.
If you are looking for something in particular, you can use: