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
  • 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

  • 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.

|improve this answer|||||
  • 1
    OP could also directly pipe the output to xclip with e.g. sudo apt update | xclip -selection clipboard to save the first step. – dessert Sep 10 '17 at 6:59
  • 1
    Also you could mention the setting LANG=C to get english output. – dessert Sep 10 '17 at 7:01
  • Thanks for your comments, @dessert. I will edit my answer :-) – sudodus Sep 10 '17 at 7:02

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