Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix log of users's entries 1

Status
Not open for further replies.

ernieaw

Programmer
Joined
Oct 25, 2002
Messages
1
Location
US
Is there more-than-one way to keep
a "log" file of a user's entries during
a session in an xterm ("Unix") window?

(1) I'm using Kornshell.
The user: ".profile" file has:
HISTFILE=$HOME/.sh_history

(2) So far, I am doing it this way:
using the Kornshell, with:

ksh<enter>
history > user_entries <enter>
cat user_entries <enter>


(2) or:
cat .sh_history <enter>


(3) Is there any other (simple)
way to do this.

Thanx, in advance.
 
You can do a...
[tt]
tail -f ~username/.sh_history | tee userscmds.log
[/tt]
...to keep collecting the commands as they're entered. The [tt]-f[/tt] option of the [tt]tail[/tt] command means to &quot;follow&quot; the input. That means it will keep the history file open and collect anything that's added to it.

Piping it to [tt]tee[/tt] will let you both collect it in a log file and see it as it's coming across.

You'll need to be root for this to work.

Hope that helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top