coiai Logo

This article is an English translation of the original Japanese post. Read the Japanese original →

Ubuntu: How to Copy Terminal Output

July 19, 2024

Categories: Linux · Tags: Ubuntu

😯What is this?

When using Ubuntu, mouse selection isn't always available when you want to copy terminal output.

This is a note on how to copy it using a command instead.

🌵Environment

  • Distributor ID: Ubuntu
  • Description: Ubuntu 24.04 LTS
  • Release: 24.04
  • Codename: noble

🔧How to do it

Install the xsel command

sudo apt install xsel

Add the following to the end of the command you want to run

 | xsel --clipboard --input

and the output will be copied to the clipboard.

sudo ufw status | xsel --clipboard --input
Ubuntu: How to Copy Terminal Output | coiai Inc.