Take website screenshot from terminal (BASH Script)

This post show you how you can take a website screenshot from terminal.

You will need Google Chrome or Chromium.

1. Install Google Chrome or Chromium on your computer

Debian or Ubuntu

sudo apt-get install chromium-browser

Fedora, CentOS, RHEL

sudo yum install epel-release
sudo yum install chromium

2. Bash script

#!/bin/bash
chromium –headless –disable-gpu –enable-logging –virtual-time-budget=10000 –window-size=$3,$4 –screenshot=$1.png $2
Put this in a file screenshot.sh, and make it executable:
chmod +x screenshot.sh

Call arguments:

screenshot.sh image_name website_url screenshot_width screenshot_height

Example:

screenshot.sh example https://example.com 640 360

If you need a reliable Dedicated Server or VPS, you should definitely try InterServer Hosting. You can test InterServer for 1 Penny, for the first month, using this coupon code: WSG1PENNY.