Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to view entire command results in terminal

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
ILC77
Posts: 62
Joined: 2014-03-23 00:37

How to view entire command results in terminal

#1 Post by ILC77 »

I am wondering how I get to see the entire list of command results in the terminal. For example,when I run the command

Code: Select all

sudo dpkg -l
the terminal only allows me to scroll part way up the list before it stops. Is there a way that I can scroll higher and see all my command results?

This also happens when I look for a software package using

Code: Select all

apt-cache search
and the list of search results is really long.

User avatar
saulgoode
Posts: 1445
Joined: 2007-10-22 11:34
Been thanked: 4 times

Re: How to view entire command results in terminal

#2 Post by saulgoode »

Pipe the output to a paging program such as less:

Code: Select all

sudo apt -l | less
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan

User avatar
mor
Posts: 970
Joined: 2010-08-28 15:16
Location: mor@debian

Re: How to view entire command results in terminal

#3 Post by mor »

I would like to add that, since I understand we're talking about a terminal emulator, there is usually a preference option to increase the scrollback buffer to a higher number of lines.
Check the preferences or options menu of you terminal emulator and you will most likely be able to do that.

But always keep in mind what saulgoode told you because when you are on a real terminal you just can't scroll back (as far as I know).

User avatar
saulgoode
Posts: 1445
Joined: 2007-10-22 11:34
Been thanked: 4 times

Re: How to view entire command results in terminal

#4 Post by saulgoode »

mor wrote:But always keep in mind what saulgoode told you because when you are on a real terminal you just can't scroll back (as far as I know).
On a real terminal you should be able to navigate previous pages with SHIFT+PAGEUP and SHIFT+PAGEDOWN, however, you can't scroll smoothly line by line and the scroll buffer is forgotten as soon as you switch to a different terminal.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan

User avatar
mor
Posts: 970
Joined: 2010-08-28 15:16
Location: mor@debian

Re: How to view entire command results in terminal

#5 Post by mor »

I can't deny that I kinda hoped you (or somebody else) would reply and teach me something.

Much obliged! :D

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: How to view entire command results in terminal

#6 Post by dasein »

Another option is to direct the output to a file that can then be opened with any text editor. Something like so:

Code: Select all

ls -l > filelist.txt

emarsk
Posts: 38
Joined: 2011-07-28 14:42

Re: How to view entire command results in terminal

#7 Post by emarsk »

For all my terminal work I use tmux, which has nice scrollback capabilities (with search and copy-paste features).
screen is a similar alternative.

I still use less when I know that I want to read a very long output, and it has a filter feature that is killer: type "& pattern" in less and it will show only the lines matching "pattern", just like grep, but with grep you need to re-run the command to get the output again when you change pattern, while in less you still have the entire output at hand.

kedaha
Posts: 3521
Joined: 2008-05-24 12:26
Has thanked: 33 times
Been thanked: 77 times

Re: How to view entire command results in terminal

#8 Post by kedaha »

In the default terminal Edit->Profile preferences->Scrolling->Unlimited Solved
And, while you're about it you may like to do: Colours->Uncheck "Use colours from system theme" and select "Green on black" which I've found is more restful on the eyes than black on white.
DebianStable

Code: Select all

$ vrms

No non-free or contrib packages installed on debian!  rms would be proud.

User avatar
mor
Posts: 970
Joined: 2010-08-28 15:16
Location: mor@debian

Re: How to view entire command results in terminal

#9 Post by mor »

@dasein
Thanks, I have used it on several occasions, but now that I know I can scroll on the real terminal too, I am gonna be just fine with that.

:)

Post Reply