Bash Script to Launch Multiple Chrome Windows On Ubuntu 20.04

If you’re looking to setup something nice to be displayed on a few screen in your home office or even at your workplace, you can do this easily on a low cost computer running Ubuntu 20.04.


  1. Ubuntu Desktop
  2. 1 or more screens connected to Ubuntu Desktop
  3. Chromium Browser (Google Chrome will NOT work)
  4. Some knowledge of Ubuntu Terminal / Bash
  5. SSH enabled (optional)

Step 1

Install Ubuntu Desktop 20.04 on a physical computer. A virtual machine will not work in this case since we will be displaying on physical screens connected to the device.

Step 2

Login to your new Ubuntu Desktop and create a file in your Documents directory. The user must have sudo privileges and should already since this is added by default when you create your first user during installation.

  1. Install Chromium Browser. You can install via Terminal or the built in application installer. I prefer to use terminal as it is quicker in my opinion.
  2. Launch Terminal from the applications menu and type the following commands to install Chromium Browser.
sudo apt update
sudo apt install chromium-browser

Step 3

If the previous step was successful, you will now be able to see Chromium in your applications menu. If so, continue with the steps below otherwise you will need to troubleshoot why it didn’t install.

  1. Launch terminal from the applications.
  2. Enter the following command to create a new file named in your Documents directory.
sudo nano ~/Documents/

The previous command should open up the New File in nano editor where you can now paste the following code in terminal to get you started.

Here’s what the code below is doing.

  1. The code below is developed for use on 3 screens plugged into a computer running Ubuntu Desktop with Chromium Browser installed. It will launch 3 browser instances with one instance per screen.
  2. GetTempDir() is a function I created from other sources online to create the Temp Directory for each instance of the Chromium Browser I want to launch. Without this function, we simply would not be able to launch more than one instance at a time.
  3. LaunchBrowser() is another function created in order to launch each instance of Chromium with preset or variable parameters. Notice the value for –window-position? The value I place there is a variable. This allows me to pass a unique / different value to the function as needed for positioning the various Chromium instances based on what I have entered in the sizes=() array.
  4. Copy the code and past it into terminal via the command described at the beginning of Step 3.
  5. Feel free to modify the URLs in the sites array as well as the sizes. The sizes are x,y coordinates of the screens. In this case, each screen is 1920 x 1080 and by using the values below with –start-fullscreen flag enabled, it positions them fullscreen on each display so there is no need for me to get too picky on the coordinates.
  6. NOTE: for 1 or more screens, simply add or remove lines from both the sites and sizes arrays. Both arrays must have the same number of lines in order for the code to work properly.
  rand=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w20 | head -n1)

  chromium-browser \
    --start-fullscreen \
    --no-first-run \
    --new-window \
    --disable-restore-session-state \
    --no-default-browser-check \
    --disable-java \
    --disable-client-side-phishing-detection \
    --window-size=1280,720 \
    --window-position=$2 \
    --user-data-dir=$temp \
  $1 &



for ((i = 0; i < ${#sites[@]}; ++i)); do
  #echo "${sites[$i]}" "${sizes[$i]}"
  LaunchBrowser "${sites[$i]}" "${sizes[$i]}"

Once you have the code adjusted to suit your needs, we need to save the file by clicking ‘Control’ + ‘X’ to exit and then type in ‘Y’ and hit enter on your keyboard. At this point, we want to stay in Terminal since we have one more thing to do.

Step 4

Sure, we made the bash script and that’s all fine and well, but we have one minor problem… The file cannot be executed since it does not have execute privileges. So, we need to change the privileges via Terminal / Command Line to allow it.

While still in Terminal, you should still be in the Documents directory. Enter the following command to allow your new file to be executed.

sudo chmod +x

That should do the trick! Let’s stay in terminal for the next step…

Step 5 – Testing

Let’s try launching the script and see if it works. Type the following command in Terminal and it should run the script and launch Chromium with the values you have above. For my script shown above, it should launch 3 different Chromium instances.


If it doesn’t launch, you may see some errors displayed in terminal, otherwise launch was successful and we done.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.