LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-21-2009, 01:41 AM   #1
crackpipe
Member
 
Registered: Nov 2005
Distribution: Slackware, Zenwalk, Debian
Posts: 33

Rep: Reputation: 15
save terminal scroll to file


I'd like to save what scrolls in my terminal into a file. Let's use "make" as an example. Suppose I run "make" to compile some program and I have thousands of lines of errors. I'd like to save the scrolled lines to a file to grep for specific content. So, I do something like this:
Code:
$ make > errors
. Instead of the thousands of lines of errors, all I will see is something like this
Code:
$cat errors
make -C /lib/modules/2.6.28.7/build SUBDIRS=/home/foo/Download/someprogram/Module modules
make[1]: Entering directory `/usr/src/linux-2.6.28.7'
  CC [M]  /home/foo/Download/some program/Module/main.o
make[1]: Leaving directory `/usr/src/linux-2.6.28.7'
That is, all of the thousands of lines of code between "make" beginning and exiting are absent, so that something in my command does not capture what prints to the screen. Does someone know the command for how to capture everything from a terminal? In other words, this is not a "make" specific question; I'm uninterested in a "make" specific logging switch or some such. I'm interested in how to pipe anything scrolling on the screen to a file - I've used "make" only as an easy example here. Thanks.
 
Old 04-21-2009, 02:05 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,458

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
make sends the messages to standard error. To save what you see on the terminal, redirect standard error to standard output and use tee as in
Code:
make 2>&1 | tee build.log
 
Old 04-21-2009, 02:28 AM   #3
crackpipe
Member
 
Registered: Nov 2005
Distribution: Slackware, Zenwalk, Debian
Posts: 33

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by colucix View Post
make sends the messages to standard error. To save what you see on the terminal, redirect standard error to standard output and use tee as in
Code:
make 2>&1 | tee build.log
Many thanks; exactly what I'm looking for. This should work with a lot of circumstances, which is what I'm looking for. Going to have fun investigating "tee", I can see. Thanks.
 
Old 04-21-2009, 03:54 AM   #4
Libu
Member
 
Registered: Oct 2003
Location: Chennai
Distribution: Slackware 12.1
Posts: 165

Rep: Reputation: 36
Can also be done as:
Quote:
make > build.log 2>&1
Or if you want the errors in a separate file
Quote:
make >build.log 2>build_error.log
 
  


Reply

Tags
logging, terminal


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal doesn't scroll with output lwnexgen Linux - Newbie 1 04-05-2008 05:06 PM
Scroll with arrow keys in the terminal window? halfpower Debian 1 09-28-2005 04:59 AM
scroll lock stops/pauses terminal? fibbi Linux - Software 0 02-03-2004 07:40 PM
Bash: show on terminal and save to file shadowhunter Linux - Newbie 5 12-13-2003 04:49 PM
Gnome Terminal/Tail/ mouse scroll wabbit Linux - General 1 04-16-2003 07:58 PM


All times are GMT -5. The time now is 09:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration