TransWikia.com

How to capture screenshot of a command runs in Linux

Unix & Linux Asked on December 6, 2021

Is there any way to capture a screenshot of the executed command output in Linux?

Example: We have the command ls -lrt /root/.

Whatever the output of the above command, I want to capture it in an image.

2 Answers

My suggestion would be using imagemagick with a command like:

ls -lrt /root/ |fmt | convert -size 1000x2000 xc:white -font "CourierNew" -pointsize 24 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 +repage image.png

Basically, you need to format the text so that imagemagick can handle it correctly. Therefor you must pipe the command via "fmt".

Only then you can convert the text output into an image with the command "convert". I have used here CourierNew, since I am used to that font :-D but if you don't like it, a "convert -list font | grep Font:" will give you all the fonts you can use.

I hope that helps answer your question!

Answered by Alessandro Perucchi on December 6, 2021

You can make a screenshot of a terminal window ( https://askubuntu.com/questions/194427/what-is-the-terminal-command-to-take-a-screenshot ). To make it free from any additional data you may run clear before any such command.

Answered by Artem S. Tashkinov on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP