LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-24-2006, 03:00 AM   #1
jimmax777
LQ Newbie
 
Registered: Aug 2003
Location: Mumbai, India
Distribution: Red Hat 9
Posts: 26

Rep: Reputation: 15
Capture all stdin of shell to a file.


Hi Linuxers

I am trying to make a script which will enable me to capture all the commands I type on my prompt to be saved into a file. I know it is possible just that I cannot find link to it on the net and I dont know how to do it. Any help will be really appreciated.

Thanks
 
Old 08-24-2006, 03:24 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Why do you need that?
See the man pages of your shell, especially the 'history' command.
 
Old 08-24-2006, 03:28 AM   #3
jimmax777
LQ Newbie
 
Registered: Aug 2003
Location: Mumbai, India
Distribution: Red Hat 9
Posts: 26

Original Poster
Rep: Reputation: 15
I need to save all the day's work and see whats happenning

I am working on a new product and I shall be running a lot of commands. So I just want to save it to a particular file. Thats it. I know it can happen. Its not about shell pages. Its just a small script.

Anyways thanks for the concern.
 
Old 08-24-2006, 05:22 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You could use the "script" command for creating a typescript of your terminal session, but it probably also saves the output of your commands. So, you may want to add output redirection to your commands if you don't want to get your output in the typescript file.
 
Old 08-24-2006, 05:25 AM   #5
jimmax777
LQ Newbie
 
Registered: Aug 2003
Location: Mumbai, India
Distribution: Red Hat 9
Posts: 26

Original Poster
Rep: Reputation: 15
Yes I know about the script command but I dont want the output also to be re-directed. I just want that whatever goes to stdin should be copied to the file.

Anyways thanks.
 
Old 08-24-2006, 06:22 AM   #6
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
The following works with Bash (to some extent at least):
Code:
exec 0< <( tee -a logfile )
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
read from stdin in a shell script bujecas Linux - General 3 07-03-2009 04:46 PM
How to capture both stdin and stdout of a child process? jineshkj Linux - Software 2 04-21-2006 06:34 AM
Capture 'make' Output to File Kenji Miyamoto Linux - Software 4 05-23-2005 05:56 PM
How to create a shell script that reads something from stdin? ricky_ds Programming 2 05-17-2005 05:06 AM
thread specific stdin,file descriptors node047 Linux - General 3 04-08-2005 02:12 AM


All times are GMT -5. The time now is 03:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration