6

When I am using "aptitude search", usually some results will be too long to be held in the console window. So are there any ways to display each result in multiple lines, so that I can see the full sentence? Thank you.

Snapshot: Snapshot of "aptitude search"

Ziyuan
  • 218

1 Answers1

5

The simpler thing you can do, without using an option for the display format, is to change the display width.

aptitude uses as display width that of the terminal, or a fixed width of 80 if cannot determine the terminal width (i.e. when you pipe the result to another command).

You can change that with the -w option, for example:

aptitude -w 200 search pattern

Unfortunately, the field containing the package name expands considerably, and don't seem to be controllable through the format option (-F).

Also, could be useful to pipe the result to less -S: the -S option makes less to not wrap line longer than the terminal width. What seems to be cut can be seen using the right and left arrows.

enzotib
  • 93,831
  • Though less -S can use arrows to navigate but what cannot be seen still cannot be seen. – Ziyuan Nov 18 '11 at 17:50
  • @ziyuang: remove -S and increment the number 200 (that was just an example) until you can see all you need. – enzotib Nov 18 '11 at 17:59
  • -w some_number works well. I mean piping to less does not change the line-chopping. – Ziyuan Nov 18 '11 at 18:31
  • Thanks! This is nice that they thought about it in aptitude search; I was rather hoping to find a general solution, like passing a environment variable to any program writing to a pipe, to think it is in a terminal of width N. Anyway, this option is a must, when piping like aptitude search something | grep something_else. – Tomasz Gandor Jul 25 '14 at 10:57