Tag Archives: Bash

Script to count number of logged in users to OpenVPN

To get that information you need to query your openvpn-status.log file, which usually resides in /var/log/openvpn/openvpn-status.log. A normal cat will show the following: OpenVPN CLIENT LIST Updated,Wed Mar 5 11:57:51 2019 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since someuser,someip:55530,100686479,319036434,Tue Mar 5 … Continue reading

Posted in Linux | Tagged , , | Leave a comment

Touchpad enable/disable script and shortcut on Ubuntu 18.10

If your laptop doesn’t have a working switch for turning on/off your touchpad, then this post is for you. Create a script called disenable_touchpad.sh and add the following code to it: !/bin/bash state=$( gsettings get org.gnome.desktop.peripherals.touchpad send-events ) if [ … Continue reading

Posted in Linux | Tagged , , , , | Leave a comment

How to beautify XML text on command line in Ubuntu

sudo apt install libxml2-utils echo ‘your xml stuff here’ | xmllint –format – You will get a beautiful well-organized XML output. Sources: https://jahansyed.co.uk/2016/04/22/how-to-install-xmllint-in-ubuntu/ https://stackoverflow.com/questions/16090869/how-to-pretty-print-xml-from-the-command-line

Posted in Linux | Tagged , , , , , | Leave a comment

How to check packages support status for Ubuntu 18.04

To know which packages are supported and which are not, for how long and whether the community or canonical are the ones who support it, just run: ubuntu-support-status It will give you this sample output: Support status summary of ‘$HOSTNAME’: … Continue reading

Posted in Linux | Tagged , , , , | Leave a comment

A tiny script to replace all occurrences of a string in a file with another string

sed -i ‘s/original/new/g’ filename.txt This basically replaces every occurrence of the “original” string with the “new” string in the file named “filename.txt” e.g. sed -i ‘s/192.168.0.1/192.168.1.1/g’ /etc/fstab Will replace all occurrences of the IP “192.168.0.1” with the IP “192.168.1.1” in … Continue reading

Posted in Linux | Tagged , , , | 1 Comment