nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

How to save history of a hung terminal

This is a discussion on How to save history of a hung terminal within the Linux software forums, part of the Linux Getting Started category; Hi all, I am a bit confused. Some of the Engineers in my org and I need to login to ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Linux answers from nixCraft.


Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19-06-2006, 10:35 PM
Member
User
 
Join Date: Jul 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ricc
Default How to save history of a hung terminal

Hi all,
I am a bit confused. Some of the Engineers in my org and I need to login to a remote site to keep log and diagnose any problems. We use ssh to do this.

What I have observed is that if someone logs in and loses the connection in between( i.e before he logs out), we have a hung session. And if we kill the process upon login again, the command history of that hung session is lost.

I am not sure, but I think that when we kill the hung session, it doesn't write back to the .bash_history. Is there a way that we can save the command history of this hung session?. Or am I wrong altogether. Does it save the command history even when we kill the hung session.

I hope you all have understood what I am saying. .

ricc
Reply With Quote
  #2 (permalink)  
Old 20-06-2006, 12:16 AM
tom tom is offline
Contributors
User
 
Join Date: Jun 2005
Location: London, UK
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 5
tom is on a distinguished road
Default

Put script command in ~/.bash_profile it will write session to file called typescript. Read man page of script for more information.
Reply With Quote
  #3 (permalink)  
Old 20-06-2006, 12:21 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 246 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default Force bash history command to write the history file

By default history isn't written to the file called .bash_history until you logout. To force the write use following command:
Code:
history -w
Setup a cron job for history -w that will write out history every 1 minute or according to your setup.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
how to open an pdf file(.pdf) in terminal chandrasekar Getting started tutorials 1 27-03-2008 12:41 AM
Installation hung up at 85% alleykat Getting started tutorials 1 01-11-2007 09:51 AM
wget url marked 'save target-as' sasuhaib The Hangout 0 14-09-2007 11:17 AM
How can I take a screenshot from an X TERMINAL? sweta Shell scripting 4 20-07-2006 07:51 PM
Command history ricc Linux software 1 26-04-2006 04:57 PM


All times are GMT +5.5. The time now is 04:51 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38