LinuxQuestions.org
Visit Jeremy's Blog.
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 10-07-2010, 12:58 PM   #1
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Rep: Reputation: 0
How to avoid auto scroll in Xterm


Hi All,

I'm using Xterm. While running a prog/command if I scroll up and reading something on the screen, the xterm view resets to bottom if there is some output from the running command.

I tried enabling/disabling jump scroll, asynchronous scroll, scroll to bottom on tty output options of Xterm with no avail. In one way or the other way, the screen is scrolling or resetting to bottom if there is some output to screen.

I want to stop this behavior and the scroll should work as if it is in Konsole. The new output to screen should simply add at the bottom and the current viewing point should remain unscrolled. pls let me know if there is any working solution for this xterm problem.

Thanks a lot,
Kamal
 
Old 10-07-2010, 10:22 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Have you tried piping output of the app/script through less?

./some-script | less

That should hold at one screenfull, then press the spacebar for the next screenfull.

Use the up/down arrow keys to move up or down through the output.
 
Old 10-08-2010, 12:22 AM   #3
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Hi bigrigdriver,

Thanks for the suggestion. But this does not serve my purpose unless I want to read the output from the command.
what if I want to read something already scrolled off which is the output of previous commands?

Is there any way to hold the xterm view?

Thanks,
Kamal
 
Old 10-08-2010, 04:11 PM   #4
rustek
Member
 
Registered: Jan 2010
Location: Melbourne, IA, USA
Distribution: Ubuntu
Posts: 93

Rep: Reputation: 8
Control s
will stop it.

Control q
will restart it.
 
Old 10-08-2010, 05:35 PM   #5
jcmlq
Member
 
Registered: Aug 2009
Posts: 32

Rep: Reputation: 19
I don't think there is any way to do exactly what you are asking with xterm.

If you are looking to view the output of arbitrary commands during a session then you can turn on logging via the VT menu (ctl-button1) it will create a logfile named XtermLog.$random that you can tail -f or grep or paginate as you need.

You could also run the session inside the 'screen' program and have it create a logfile. Screen is also generally handy for dealing with terminals.
 
Old 10-08-2010, 05:39 PM   #6
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Hi,

will Ctrl+S stops the command being running temporarily or it will stop the command output only but the command will be running in background and the output is buffered?

Thanks,
Kamal
 
Old 10-08-2010, 07:00 PM   #7
rustek
Member
 
Registered: Jan 2010
Location: Melbourne, IA, USA
Distribution: Ubuntu
Posts: 93

Rep: Reputation: 8
I just remember it from the old days of terminals, it does not stop the program just the screen, it will buffer the output until the screen buffer overflows then you will start losing the output.

I use it while doing a tail -f so I can stop the screen output long enough to scroll up and read something that has gone past.
 
Old 10-08-2010, 07:25 PM   #8
rustek
Member
 
Registered: Jan 2010
Location: Melbourne, IA, USA
Distribution: Ubuntu
Posts: 93

Rep: Reputation: 8
I just tested it and with tail -f and it works as I described.

But it appeared to suspend this script?

for counter in `seq 6001 6500`; do
echo $counter
sleep .01
done

So what it will do seems to depend on circumstance, so be aware of that.

Russ
 
Old 10-09-2010, 02:30 AM   #9
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Hi Russ,

Thanks for the heads up. I found that Ctrl+S suspends the current running foreground command also.
workaround is while running the command add "&" so that it will run in background even if we press Ctrl+S. command will run in background, only output will be suspended from showing on the screen. this output is buffered and written to screen when you press Ctrl+Q.

But still,,, is there a perfect solution where we can hold the screen view in xterm while the command output simply adds at the end (just like in Konsole)??

Thanks,
Kamal
 
Old 10-09-2010, 03:15 AM   #10
rustek
Member
 
Registered: Jan 2010
Location: Melbourne, IA, USA
Distribution: Ubuntu
Posts: 93

Rep: Reputation: 8
Possibly, but I don't know of it.

Sometimes just reducing the output can help a lot. eg.

command|grep -v "text1"|grep -v "text2" etc.

To remove any unneeded lines from the output.
Slows down the scrolling.

You obviously want to see this stuff in real time, and that's ok, but I usually don't bother, I just grep bits I want out of saved files or write a script to look for me and take action or email me depending on what it finds.
 
Old 01-20-2011, 02:56 AM   #11
__PJ
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Rep: Reputation: 0
You can do this a couple of ways. Either through your ~/.Xdefaults or ~/.Xdefaults-<hostname> depending on your OS, add the line:

XTerm*scrollttyoutput:false

Also add the following to jump to the bottom on keypress:

XTerm*ScrollTTYKeypress:true

Any time you modify this file, read it back in with xrdb ~/.Xdefaults

Alternatively, start xterm with -si -sk options. IE: xterm -si -sk

Ref: man xterm.

Last edited by __PJ; 01-20-2011 at 02:57 AM. Reason: Typo
 
Old 01-21-2011, 05:34 AM   #12
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Hi PJ,

Thanks for your reply. But none of this is helping. With your options, xterm viewpoint stays constant (scroll bar position) but the text keeps on scrolling.
These options behavior is not equal to Konsole.
In Konsole, text stays constant and scroll bar moves when new o/p adds to the screen. If the current text has to be moved out of Konsole history, then only text starts scrolling as scroll bar already reached top most position.

Thanks,
Kamal
 
Old 01-24-2011, 03:42 AM   #13
__PJ
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Rep: Reputation: 0
Hmmm, you're right. Perhaps I should test before posting. This has changed at some point; even downloading the latest xterm (267) and compiling doesn't work.

I have been playing with mrxvt also. If you're not locked into xterm, give it a go. It definitely has the desired effect and a few other niceties such as tabs, transparencies etc and is lightweight.

Here is a .mrxvtrc which should get you started. The only downside I've found so far is that copy to clipboard isn't implemented.

Mrxvt.scrollTtyKeypress: true
Mrxvt.scrollTtyOutputInhibit: true
Mrxvt.saveLines: 1000
Mrxvt.geometry: 120x40
Mrxvt.holdExit: false
Mrxvt.autohideTabbar: true
Mrxvt.background: white
Mrxvt.foreground: black
!Mrxvt.transparent: true
!Mrxvt.shading: 45
!Mrxvt.transparentTabbar: false
!Mrxvt.showMenu: false
 
Old 01-25-2011, 07:32 AM   #14
kamalp
LQ Newbie
 
Registered: Sep 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Hi PJ,

Thanks for your help.
I use copying to clipboard heavily. so I can't go for mrxvt.
I'm using Konsole for all my current purposes. The only downside of Konsole is that it is very slow in text scrolling compare to xterm.

Thanks,
Kamal
 
  


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
How to get tab auto complete in bash to scroll through all possible choices joeldick Linux - Software 5 04-06-2011 05:27 PM
Problem with Auto-Shrinking xterm lmaza Linux - Desktop 3 01-08-2009 08:44 AM
auto scroll license agreement in bash doronunu Linux - General 2 12-27-2007 02:22 AM
Auto reload and scroll dowm in FireFox? x_terminat_or_3 Linux - Software 5 04-29-2007 09:38 AM
console/xterm scroll? marlor Slackware 4 08-04-2004 11:41 PM


All times are GMT -5. The time now is 02:15 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