I know about minted and listings, but either of those are intended for formatting of programming languages excerpts. Is there a package that would do the same for Linux terminal excerpts?

Such as:

peter@kbpet:~$ echo $(uname -i)

The minimal solution would be to automatically embolden the peter@kbpet: to every line and indent the leading line of each block.

The other major convenience sought is math symbols like $ and _ should be automatically interpreted as escaped.

  • What kind of extra formatting are you looking for? My terminal output is just fixed-width text. I know some programs can output colours but this is not based on syntactic information so highlighting it will be difficult (e.g., ls colouring certain file types or permissions).
    – Pieter
    Sep 25 '11 at 9:55
  • @Pieter: The minimal solution would be to embolden the $bob@system: prelude to every terminal line and indent the leading line of each block.
    – ptrcao
    Sep 25 '11 at 9:59
  • 4
    Both packages support bash as language. So you should this give a try. Sep 25 '11 at 10:01

What do you think about this suggestion:



peter@kbpet:~$ echo $(uname -i)


enter image description here

  • On the right track. Can the peter@kbpet: be emboldened, and can output be a different colour, indented, or otherwise set apart from the user's input?
    – ptrcao
    Sep 25 '11 at 11:39
  • @ptrcao: Sorry but I don't know what you mean. Sep 25 '11 at 11:50
  • @ptrcao: I edited my post. What do you think? Sep 25 '11 at 12:18
  • Yep, getting real close. The last request is that the terminal output, in this case x86_64 be indented. The difficulty is that there is no intelligent way to program a macro that will distinguish output lines from commands. It seems it has to be manually done at this stage, which makes it impractical as all the possible commands and outputs will be prolific and inexhaustible. If anyone is smart enough to conceive of a macro that could distinguish terminal output from commands intelligently by getting feedback from the the OS itself, that would make my day. For now, answer accepted.
    – ptrcao
    Sep 26 '11 at 13:18
  • This can be done by 'write18' Sep 26 '11 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.