Archive for January, 2024

Open and Move a Web Browser Window from a Script

📅 January 28, 2024
“Is it possible to open a web browser from a script and then manipulate it using wmctrl?”

Yes, but this is not as straightforward as it seems.

Let’s open a GUI web browser from a script so we can view the real-time pihole log queries and move that window to any workspace or location on the desktop.

What? You already have it figured out?

Well, well, Little Grasshopper, unless you have attempted to code this behavior for yourself, you might be in for a surprise.

I thought this would be simple too, but it turns out that I was mistaken. The browser would not relocate despite coding everything correctly. Here is how to fix that using a few tricks.

Read the rest of this entry »

, ,

Leave a comment

Open Windows on Specific Workspaces

📅 January 25, 2024
“Is it possible to open a terminal on a specific workspace instead of the current one?”

Yes!

We can position a gnome-terminal anywhere on a desktop workspace using its geometry option, and we can go further by moving that window off-screen to a different workspace using wmctrl.

Here is how to achieve this magic.

Read the rest of this entry »

, ,

Leave a comment

Monitor Pi-Hole Remotely with PADD in a Terminal

📅 January 22, 2024
Curious to see what Pi-Hole is doing?

Sure, we can use the FTL web-based GUI in a browser, but perhaps you are limited to a terminal interface or maybe you are Mr. Ubergeek who desires a terminal that autoloads in a terminal on your desktop at system startup. Or maybe you just want options.

This is completely possible!

Let’s create a script that displays two terminals at preset locations on the desktop where one terminal shows Pi-Hole statistics using PADD and the other shows the Pi-Hole host system information using bpytop.

Read the rest of this entry »

, ,

Leave a comment

Open and Monitor Multiple SSH Terminals at Once

📅 January 21, 2024
“So many remote hosts, so many logins. Can we automate this?”

Suppose we have multiple remote systems that we need to monitor as a group. Usually, we open a terminal for each remote system, SSH with a password, and then interact with the remote systems to perform updates or htop monitoring.

Wouldn’t it be easier if we could run a script that automatically logs into each remote system via SSH for us and display whatever we want to see in each terminal?

This takes a little time to set up, but we can write a script that does this for us to make the terminal windows appear quickly and in specified positions on the Linux desktop!

Read the rest of this entry »

, ,

Leave a comment

How to Position a Bash Terminal

📅 January 20, 2024
“I want to be fancy and open a terminal at a specific (x, y) coordinate.”

When we open a Bash terminal, such as gnome-terminal, it will open smack dab in the center of the screen. This is fine for a single terminal, but when opening several, they stack on top of each other (at least they do in Linux Mint).

Is there a way to manually specify where a terminal opens in addition to its size?

Indeed there is!

Read the rest of this entry »

, ,

Leave a comment

Creating Temporary Files in Bash

📅 January 19, 2024
“How can I create a temporary file for noncritical stuff when running a bash script?”

Easy!

The built in mktemp command creates a 100% unique file or directory where you can store temporary data or whatever you need for your script.

Read the rest of this entry »

Leave a comment

Mini PC Part 8: Unbound – More DNS Privacy for Your Pi-Hole Setup

📅 January 17, 2024
“Pi-Hole is blocking ads, but how do I know the given DNS request is for an authentic site? I want more protection and privacy!”

You cannot possibly know for certain. All you can do is trust, trust, and again trust your upstream DNS provider that you are not redirected to a phishing/malware site due to DNS poisoning or other such tricks that can happen.

Most of the time, things are fine, and this is not an issue for most internet surfers. If you want to check a banking site, then that is where you end up. If you want to watch online videos, you usually arrive at the sites you expect…or do you?

Some of us want to be certain, and that is where Unbound enters the picture.

This was surprisingly easy to setup on a local Pi-Hole mini PC — in fact, easier than setting up Pi-Hole itself, and given the added benefits, it is hard to argue against using Unbound. Here are my results.

Read the rest of this entry »

,

Leave a comment

What is 2>&1 (File Descriptor) ?

📅 January 4, 2024
“No, this is not a Q*bert expletive nor is it a mathematical expression.”

When perusing Bash scripts, you might encounter an odd-looking sequence of characters similar to this:

lolcat somefile.txt 2>> error.log

or this:

lolcat somefile.txt 2>&1

It might appear cryptic, but Linux, which is based upon UNIX, implements simple yet powerful concepts that perform predictably according to specific rules. One concept is the file descriptor, and it can be used to control the flow of data as you run and chain commands from the command line or a script.

Read the rest of this entry »

,

Leave a comment