In this tip we will see how to create a screenshot for the output of a command executed by the terminal under Ubuntu/Debian. This may help you give your readers more information about a specific command when writing tutorials on your website or blog. Also, it may help you find solutions to your problems when asking for help at forums.
To be able to take command output screenshots, we will need first to install "imagemagick", simply run this command:
sudo apt-get install imagemagick
Then via the terminal, run this command (white background):
df -h | convert -resize 500 -background black -fill white label:@- image.jpg
- 500: replace 500 with any size of your choice
- black: This is the background color
- white: this is the text color
- image.jpg: this is the name of the screenshot that will be generated
To generate for example an image with a white background, then use this command:
df -h | convert -resize 500 label:@- image.jpg
The generated image will be created in the current folder. That's it!