3

I would like to post part or all of a Terminal result (i.e. Sudo apt get update). How does one capture some or all of the data in the Terminal and paste it into Ask Ubuntu? Also, if there is a way, will it have the same appearance as the Terminal text (font, line returns etc)?

  • Of the methods in the dupe, even though pastebinit is the top-voted, I'd suggest that you use it only if the output is very long. For most use cases, copying directly to the post and applying code formatting would be preferable, since we like to posts to be as self-contained as possible. – muru Sep 10 '17 at 10:05

1 Answers1

2
  • If you are not using English, it will help us understand the output, if you set the language in the terminal to English with the following command

    LANG=C
    
  • In many terminal windows you can mark everything via the dropdown menu 'Edit', and then use the same dropdown menu to copy it (to the clipboard).

    An alternative is to install the program page xclip and then pipe the output to the program xclip as shown in the following example,

    sudo apt install xclip
    sudo lsblk -fm | xclip -selection clipboard
    
  • After that you can paste it into the editing window of AskUbuntu.

  • Finally you can render it as 'code' either with the icon {} above the editing window or by indenting each line four spaces. If the surrounding text is already indented you need to indent eight spaces.

sudodus
  • 46,324
  • 5
  • 88
  • 152