How to securely edit configuration files as specific user

Securely edit configuration files as specific user.

April 26, 2023 · milosz · Linux

How to follow data appended to a file using tail command

Follow data appended to a file using one of the two possible approaches.

How to prepare Microsoft Windows USB installation media on Linux using WoeUSB

Prepare Microsoft Windows® USB installation media on Linux using WoeUSB.

How to insert control characters inside text terminal

Insert control characters inside a text terminal to enhance your personal notes or improve shell one-liners.

August 12, 2021 · milosz · Linux

How to ensure that OpenSSH client uses explicitly configured authentication identity

Ensure that OpenSSH client uses explicitly configured authentication identity even if authentication agent offers more identities.

How to deal with many small log files using Filebeat

Use Filebeat to deal with many small log files.

How to trace packets as they pass through the firewall

Trace packets as they pass through the iptables firewall.

How to create custom bash prompt

Today, I will show you my personal shell prompt, so you could define your own custom bash prompt.

How to execute rc.local shell script during boot using systemd

Execute rc.local shell script during boot using systemd compatibility generator.

How to perform shell script analysis

Perform shell script analysis using shellcheck, a shell script static analysis tool.

How to format and beautify Nginx configuration

Format and beautify Nginx configuration using dedicated utilities like nginx-config-formatter, nginxbeautifier, and crossplane.

How to display bind mounts

The simplest possible solution to display bind mounts.

How to determine when the operating system was booted

I have already described how to accurately determine when the system was booted, but there is a simpler solution as you can use /proc filesystem directly.

How to fix container which cannot be started

The short story of my experience with container is marked for removal and cannot be started error which was caused by driver "overlay" failed to remove root filesystem for ...: remove /var/lib/docker/overlay/.../merged: device or resource busy.

How to extract specific file from tar archive

Extract a specific file from a tar archive.

How to increase the system-wide number of available file handles

Increase the system-wide number of available file handles (open files).

How to reboot system during recovery

Reboot Linux operating system during recovery when shell is executed instead of standard init process.

How to limit bandwidth on specific network interface

Limit bandwidth on specific network interface using wondershaper.

How to determine SSL cipher suites supported by the web-server

Determine SSL cipher suites supported by the web-server using OpenSSL.

How to display details for specific OpenSSL cipher

Display details for specific OpenSSL cipher, only single one.

How to change the number of reserved filesystem blocks

Change the number of reserved filesystem blocks.

How to pretty-print OpenSSL ciphers

Create simple shell script to pretty-print OpenSSL ciphers.

How to inspect OpenSSH client configuration

Inspect OpenSSH client configuration to search and display configured hosts.

How to merge multi-process HAProxy statistics using GNU Awk

Merge multi-process HAProxy statistics using GNU Awk. This is a duct tape solution, as you should definitely use Lua.

How to merge multi-process HAProxy statistics using Lua

Merge multi-process HAProxy statistics using Lua.

How to increase maximum socket receive buffer size

Graylog will generate a warning to inform you that socket receive buffer size (SO_RCVBUF) should be increased.

How to expand an existing XFS filesystem on LVM Logical Volume

Expand an existing XFS filesystem on LVM Logical Volume.

How to disable onboard WiFi and Bluetooth on Raspberry Pi 3

Disable onboard WiFi and Bluetooth on Raspberry Pi 3 device.

How to download Raspbian image and write it to SD card

Download Raspbian image and write it SD card using as fewer commands as possible.

How to configure command-line tab completion for known SSH hosts

Configure and enable command-line tab completion for known SSH hosts to ease day-to-day operations. You do need to configure or enable this on Debian-based distributions, but it is good to know how to do this as you will never know when it will come in handy. This article is an extension of adding the SSH menu to the Unity launcher blog post.

How to print IP address assigned to an interface

Today, I will share a simple way to print an IP address assigned to the specified interface.

How to get the number of connections broken down by a host

Display established connections broken down by a host.

How to display processes using swap space

Identify and print processes using swap space to get a better understanding of the Linux operating system.

How to edit Icewind Dale EE savegame

I have spent countless hours playing role-playing video games. Recently, I bought Icewind Dale: Enhanced Edition for Linux. It is still a great experience, but I have to admit that I have gone to the dark side and modified the save file. Just think of it as a programming exercise.

How to explain umask

I wrote a simple application to explain the current UMASK value. It was a while ago, but I want to share it with you as it is quite a useful utility.

How to search through manual pages

It was almost three years ago when I wrote about manual pages. Moving forward, I want to share a simple and useful shell script to search through manual pages.

How to fix Bluetooth sound synchronization

I have experienced a lot of trouble with Bluetooth sound synchronization. Most of the time, this issue was especially evident while watching movies. Fortunately, the solution is within easy reach.

How to inspect command before execution

It is nothing fancy, but there are situations where it is beneficial to know how to identify and inspect command before execution.

How to get names of distinct Debian releases

It is easy to get names of distinct Debian releases as you can always examine these on the Debian Releases web page. I will do something more interesting and demonstrate how to do that using a simple shell script.

How to find which package includes specific file

This brief outline explains how to locate specific file within Debian packages using very useful apt-file utility which as opposed to dpkg-query does not only inspect installed packages since it utilizes fetched lists of the contents of packages.

Hand-picked Linux related magazines

Today, I want to share my personal list of hand-picked Linux related magazines, which I am reading every month to keep up with relevant Linux news and best-practice techniques, so I strongly encourage to check out these magazines to benefit from insights of the most experienced journalists in the business.

How to mount encrypted LVM logical volume

Some time ago, I have recovered an old hard drive only to learn that it contained encrypted LVM logical volume.

How to graph Ubiquiti CCQ using Cacti

A long time ago, I wrote several blog posts which related to Ubiquiti devices, especially monitoring using Cacti rrdtool-based graphing solution. These are probably obsolete now, but someone has pursued this idea further…

How to convert manual pages to DokuWiki

I have created a simple shell script to convert manual pages to DokuWiki as I want to have them always at hand and easily interlink to them from other pages.

How to kill every eligible process

Today I want to mention about simple and neat trick described in kill manual page, which will allow you to quickly kill every eligible process.

How to pretty-print disk space used by PostgreSQL databases

I wrote a simple shell script to pretty-print disk space used by PostgreSQL databases while examining database object size functions. You can benefit from this too by inspecting used SQL statements.

How to pretty-print system uptime

It is easy to use uptime command, but custom shell script is definitely a more interesting solution as it provides more detailed information.

Tig – text-mode interface for git

Tig is an ncurses-based text-mode interface for git that uses Vim keybindings.

How to sync files with Google Drive

The easiest way to sync files with Google Drive is to use insync client which provides seamless user experience, customer support and enhanced functionality.

Atom – A hackable text editor for the 21st Century

I was using licensed version of Sublime Text editor to write articles available here, but couple days ago I switched to Atom customizable text editor.

The Hello World Program

Today I stumbled upon the The Hello World Program website and got really amazed by the humor and quality of the published videos and tutorials.

Four live distributions and three different security objectives

At first I wanted to write blog post about how to stay anonymous by using privacy enhanced OS, but changed my mind during research process as I couldn’t pass by other highly useful solutions.

How to read interface statistics on Cisco Catalyst switch using SNMP protocol

Today, I will show you how to create a simple shell script to read and print interface statistics on the Cisco Catalyst switch using the SNMP protocol.

Introduction to Linux

Do you want to find out how to perform everyday activities using Linux operating system? Learn about commonly used applications and utilities? Then register to take Introduction to Linux course created by The Linux Foundation. It will take anywhere from 40 to 60 hours to complete the course and accustom yourself to Linux.

Learn C and build your own programming language

Learning programming may seem like an impossible feat, that being said however, with the right resources and information just about anyone can learn the most essential language that is used today.

Hand-picked audio podcasts for Linux users

Although it is getting warmer and warmer, I have found some time to explore Linux related podcasts and hand-picked thirteen interesting podcasts so everyone will find something that pleases their ears and engages mind.

What is Linux?

Most people use their computers without much thought as to what it is they are actually interacting with but they are called operating systems…

How to non interactively provide password for the PostgreSQL interactive terminal

There are two ways to non interactively provide a password for the psql command (PostgreSQL interactive terminal). Each method allows you to quickly write shell scripts using terminal-based PostgreSQL utilities as you can provide user credentials from the password file or environment variables.

How to colorize text in terminal

Seven days ago I have published a shell script to highlight text in the terminal using sed or ssed. Today I want to extend the idea and colorize specified strings or simple regular expressions using just bash, getopts and ssed respectively.

How to highlight text in terminal

I have been working on a simple shell script to highlight text in the terminal for the last hour. At first, I looked at it from the wrong angle, but after a short break, I finally realized the simplest possible solution.

How to redirect command output using sudo

You have probably already noticed my favorite way to overcome the sudo redirection issue, but if you haven’t, then I will write it down here for further reference.

How to set up Raspberry Pi as a tiny NAS server

Today I will shortly describe how to set up Raspberry Pi as a tiny NAS server. I am using one at home daily, and it is a handy appliance.

How to create bootable recovery USB Flash Drive

If you ever wanted to create bootable recovery USB Flash Drive then I have good news for you as it can be achieved in several simple steps using Clonezilla Live CD, external USB Hard Drive, and a target USB Flash Drive.

How to disable automatic mounting of the removable storage devices on Crunchbang

Today I went almost crazy because of automatic mounting and opening of the removable storage devices, fortunately this behavior can be quickly changed by the use of thunar-volman-settings command.

How to control VirtualBox machine using shell

At the beginning of the last year, I wrote about VirtualBox image conversion. Today, I will continue this topic further and describe how to control the virtual machine using the command line.

Kolab – How to integrate Dokuwiki

Brief description of the Kolab Groupware integration with Dokuwiki.

Kolab – How to integrate Tiny Tiny RSS

Brief description of the Kolab Groupware integration with Tiny Tiny RSS.

Kolab – How to integrate Piwik Web Analytics

A quite lengthy but very straightforward description of the Kolab Groupware integration with Piwik Web Analytics. The integration process is simpler than you think as the additional application (Piwik) is hosted externally and doesn’t use a single sign-on.

Kolab – High CPU usage after adding a few aliases

Yesterday I added a few mail aliases using Kolab admin interface and went to sleep. Today I noticed high CPU usage and quickly found that there is a small problem with pykolab 0.5.11-5 package.

Kolab and national characters in the mail subject

I am using mainly Polish language so it is obvious that fairly quickly I encountered a problem with national characters in the subject line. Problem is not fixed in Debian packages (using Debian Wheezy x86_64 and Kolab Systems – Public Repositories) but luckily it is very easy to fix.

How to determine the sunrise and sunset times

A couple of days ago, I mentioned calculating the sunrise and sunset times. This is an interesting problem, so after reading Astronomy Answers – Position of the Sun, I quickly implemented it using C language. It is only an experiment, so results are approximate.

How to convert date to Julian Day Number using shell script

I was wondering how to calculate Julian Day Number as I will need it to determine the sunrise and sunset times. Algorithms are extensively described so I will just point you to the two most useful pages – Julian day/Wikipedia and Julian Day Numbers/UT.

How to display min and max values of the basic object types

As a small experiment, I wrote an elementary C program to display min and max values of the basic object types.

How to change port forwardings during the SSH connection

Last year I wrote a short article about how to set up SSH port forwarding but I forgot to mention that you can quickly terminate existing port forwardings and create new ones during the SSH connection.

Ajenti – Clean and simple web-based administration tool

Recently I was searching for clean and simple web-based administration tool for a couple of small virtual servers so I decided to use Ajenti. It is simple and easily extendable administration/monitoring utility using Python language. Installation is very straightforward as there are packages available for FreeBSD operating system and a couple of Linux distributions.

Console based task manager

Recently I discovered console based task manager – devtodo. It is very useful tool as you can easily use it over SSH connection, create multiple different lists and combine them together. I will shortly describe devtodo utility available in Debian package repository but you need to know that you can use newer version – devtodo 2.

How to get the date of Easter using shell command

It is very easy task as it requires only the use of ncal command.

How to read CCQ on Ubiquiti devices

Last year I published the blog post Cacti – How to graph CCQ on Ubiquiti devices. Recently I updated script, so it will work with all NanoBridge and PowerBridge devices.

Simple shell script to backup selected directories

A couple of months ago, I published a short script to backup MySQL databases. Today I created a simple shell script to backup selected directories.

Google Chrome – Recent "Couldn't load plugin" error

Yesterday I experienced quite annoying “Couldn’t load plugin” error when I tried to play any video on YouTube. It started suddenly and I was very surprised by it.

February 3, 2013 · milosz · Issue · Linux

Artha – The Open Thesaurus

I am not a native English speaker so I often use thesaurus when writing a blog post or just an email message. Long time ago I always used web based solutions but since I found Artha – The Open Thesaurus I wouldn’t change it for anything else as it has handy and slick user interface, on the fly search, suggestions and hotkey lookup.

How to graph CCQ on Ubiquiti devices

As you probably already know, the CCQ value is not available via SNMP (AirOS 5.5.2), but of course it doesn’t mean it can’t be graphed using Cacti. To graph CCQ on Ubiquiti devices, you just need to use a simple script to read the desired value using the web interface.

OpenWRT on Ubiquiti AirRouter

Recently I installed OpenWRT on Ubiquiti AirRouter as original firmware lacks in couple of areas. Installation is easy and straightforward as all you need to do at the time of writing this post is to use Attitude Adjustment release.

Simple shell script to backup MySQL databases

Simple shell script to backup MySQL databases.

How to remove comments from a shell script

The easiest way to remove comments from a shell script is to use sed (stream editor for filtering and transforming text) command.

How to determine when daylight saving time changes

When you’re not sure when daylight saving time changes you can quickly check it using the zdump command which is available on every *nix system.

How to set up SSH port forwarding

SSH port forwarding is a nice feature that allows to create encrypted tunnels over unsecured network. It is easy and straightforward to remember and use in daily work so I will describe it here with couple of examples.

PHP default timezone warning

PHP Warning: mktime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /var/www/... If you encounter similar warning, then it means that you need to set default timezone used by all date/time functions.

How to reboot Linksys WAG120N router?

For some reason unknown to me there is no reboot option in web-based user interface but it doesn’t mean that it cannot be done easily as you just need to use one specific URL parameter.

Kalkun – How to setup SMS Gateway at home

This is very easy task as you only need small Linux server and GSM terminal or any phone supported by Gammu.

How to send notifications from Android device to desktop

Recently I was playing with Growl notifications and I thought it would be cool idea to see on desktop notifications sent from my phone.

How to change RRD data source name

To change the data source name, you need to check its current value and then issue single rrdtool command.

Cacti and Mikrotik – How to graph signal strength without hassle

Signal strength on Mikrotik devices can be monitored by Cacti using SNMP protocol. It is straightforward if you have just couple of those devices but you can be easily overwhelmed by dozens of data templates because wireless card’s MAC address is part of the OID.

How to modify squashfs image

You cannot modify squashfs image directly but you can uncompress it, apply changes and compress it again.

How to check the progress of the dd process

Check the progress of the dd process.

How to convert RAW image to VDI and otherwise

VirtualBox command-line interface (VBoxManage) provides an easy way to convert the raw disk image to the VDI/VMDK format and otherwise.

How to convert Mbox mailboxes to Maildir format

Download script and run as described in manual. For example to convert /old/mbox to /new/maildir you can execute: # perl ./ -s /old/mbox -d /new/maildir Converting /old/mbox to maildir: /new/maildir Source Mbox is /old/mbox Target Maildir is /new/maildir Dummy mail system first message detected and not saved. 40 messages.

How to use physical hard disk in VirtualBox

To use a physical hard disk in VirtualBox you need to create an image that will represent it.

How to print contents of virtual console terminal

Sometimes it a good idea to check or just store contents of the virtual console terminal (/dev/vcs[1-63] device).

How to force sudo to forget password

Use the following command when you want to leave terminal open but force sudo to forget password.

How to use sudo from within Vim to save file

It is very annoying to see message “E212: Can’t open file for writing” when trying to save file. Hopefully there is a simple solution (a bit longer but without “W12 Warning“): :execute ':w !sudo tee % > /dev/null' | :edit! Look at for more solutions like :W command below: :command W :execute ':silent w !sudo tee % > /dev/null' | :edit!

January 16, 2012 · milosz · Linux · Vim

Audible ping

Add -a parameter to the ping command if you don’t look at console output, but want to hear that host is reachable.

January 11, 2012 · milosz · Linux

How to count files or directories

For this example I will use such tree: . ├── dir1/ │ ├── dir6/ │ ├── dir7/ │ ├── dir8/ │ ├── file4 │ └── file5 ├── dir2/ │ └── dir9/ │ ├── dir10/ │ │ ├── file9 │ │ └── file10 │ ├── file6 │ ├── file7 │ └── file8 ├── dir3/ ├── dir4/ ├── dir5/ ├── file1 ├── file2 └── file3 List of all files and directories: $ find .

Redshift – adjust the color temperature of your screen

Recently I started using Redshift. It is small application that changes color temperature of your screen. It is really good idea as eyes don’t get tired so quickly at night.

How to release WAN IP address on WAG120N router using wget

My ISP provider provides dynamically assigned IP address using DHCP. This solution has couple of drawbacks but it comes handy if I need to change IP address to overcome time limit restrictions on streaming services…

Create web thumbnail for SemanticScuttle using cutycapt

This simple script will create web thumbnail using cutycapt console command.

How to filter Rsyslog logs by IP address and avoid duplicates

Store and stop processing specific log.

How to find yesterday’s or tomorrow’s date using shell?

There are couple of different ways to perform this task using shell date command depending on used OS. I will concentrate on Ubuntu Linux, OpenBSD and FreeBSD.

Keep your finger on the pulse with rsyslog and LogAnalyzer

It’s easy to miss something when you need to monitor dozen of logs on different servers and some other devices. Fortunately, there is a simple solution as you can use rsyslog with PostgreSQL or MySQL support to store all local and remote events on your network and then visualize results using LogAnalyzer.

What if root hint file is out of date?

Download root hint file.

How to enable query logging in BIND

Enable query logging in BIND.

February 27, 2011 · milosz · Linux

How to sort IP addresses

Use sort utility to sort IP addresses.

How to split files by size and merge them

Lets say that we have one big file and want to split it into 10M parts.

Scripting SPS switches

Managing SPS switches could be real fun if you use expect to automate such tasks.

How to downscale video for your portable device

Sometimes I need to downscale video for a portable device.

How to get rid of spaces in filenames

Get rid of spaces in file/directory names.

HP DeskJet K209a on Arch Linux

Today I connected shiny new HP DeskJet K209a and as suspected everything works fine after I installed cups, hplip, and xsane.

January 9, 2011 · milosz · Linux

VLC – quick solution for problems with HTTPS certs

Certificate could not be verified error.

Small proxy for enhanced security, privacy and ads filtering

I prefer to use a small netbook over a desktop pc for light web browsing at home. It’s very comfortable but I need something to filter out advertisements.

How to perform HTTP compression test

Perform HTTP compression test using curl utility.

Using KDE notification area within a shell script

Using KDE notification area within a shell script gives a lot of useful possibilities as you can easily display feedback from running services, other scripts, log analyzers.

Zen Photo and Nginx – rewrite rules

If you are searching for Nginx rewrite rules for Zen Photo then jump directly to the wiki page.

December 3, 2010 · milosz · Linux · nginx

Nginx and Gandi SSL certificate

Getting an SSL certificate from Gandi is a straightforward task.

Nginx proxy and real IP address

A simple code snippet that can be used to pass client and proxy IP addresses.

December 1, 2010 · milosz · Linux · nginx