Copy a Terminal output to clipboard and sending Terminal output to file

Hi.
I hope you are all well.

As I have installed RebornOS today on one of my machines to use it as a daily driver, I am discovering things a little bit at a time, compared to Windows.

In Windows’s Command Prompt there were 2 arguments I could sometimes use because they were useful:

  1. command | clip ----> this would copy the output of the command to clipboard after being run
  2. command > file.txt ----> this would export the output of the command directly to a text file.

Are there equivalent commands for RebornOS Terminal for those 2 examples above? and if yes, would you share them with me, please?

Thank you very much ! :smiley:

Hi @laur, yes!

On a terminal, you can simply redirect a command’s output to a file. Below is an example of how you would redirect the output of journalctl -b -0 to a file:

journalctl -b -0 > logs_since_boot.txt

In fact, when you’re not able to access any GUI at all, here is how you can upload logs to an online paste service:

journalctl --since "20 minutes ago" > my_logs.txt
sudo pacman -S --needed pastebinit
pastebinit -i my_logs.txt -b dpaste.com

You’ll then get a URL that you can share!

2 Likes

Thank you so much for your help :slight_smile:
The file output method worked very well for me!

Would you also know how I could get by with copying the output of the command to clipboard?

I found something about xclip and tried it but it doesn’t seem to work for me (it doesn’t copy anything to clipboard).

EDIT: Managed to find a solution for the command to clipboard :slight_smile: It appears after I install both xclip and xsel to the system, then I can copy the output of the commands with:

command | xclip -selection clipboard
1 Like