How to display kernel slab cache information

You can directly inspect kernel slab allocator statistics (/proc/slabinfo file) for detailed information on buffer, inode, dentry, or other caches in the Linux kernel, though slabtop utility will sort and pretty-print information in real-time. ...

How to list file names and their contents

Use basic Linux utilities to list file names and their contents. ...

How to display process statistics

Use system performance tools for Linux to display process statistics. ...

How to edit file in-place

Use sponge utility to read standard input and safely write it out to the same file. ...

How to display strace summary

I have already described how to strace PHP-FPM processes, but you can also display a strace summary to get detailed information about count time, calls, and errors for each syscall. ...

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 pretty print decimal or binary numbers

Use numfmt command-line utility which is a part of the standard GNU Core Utilities to pretty print decimal or binary numbers. ...

How to redeploy master certificate in OpenShift 3.11

Inspect and redeploy the master certificate in OpenShift 3.11. ...

How to replace router certificate in OpenShift 3.11

Replacing the router certificate in OpenShift 3.11 is easier than you think. ...

How to access rdiff-backup repository using fuse

Use FUSE (filesystem in userspace) to access rdiff-backup repository. ...

How to specify custom SSH port when using rdiff-backup

Specify a custom SSH port when using rdiff-backup. ...

How to create or delete Kibana index pattern using API

Display, search, create or delete the Kibana index pattern using API. ...

How to use OpenSSL to manage PKCS #12 archive

Use OpenSSL to manage PKCS #12 archive. ...

How to rebuild hawkular metrics after cluster deploy on OpenShift 3.11

Rebuild hawkular metrics after cluster deploy on OpenShift 3.11. ...

How to install OpenShift client 3.11

Install OpenShift client 3.11. ...

How to calculate real disk capacity

Use basic linux command-line utility to calculate real disk capacity. ...

How to determine available authentication methods

Determine available authentication methods on the specified OpenSSH server. ...

How to display details for specific OpenSSL cipher

Display details for specific OpenSSL cipher, only single one. ...

How to undo fsck operations performed on the Ext4 filesystem

Undo undo fsck operations performed on the Ext4 filesystem. ...

How to reindex directories located in the Ext4 filesystem

Reindex directories located in the Ext4 filesystem after removing a huge number of files to optimize directory sizes. ...

How to inspect OpenSSH client configuration

Inspect OpenSSH client configuration to search and display configured hosts. ...

How to expand an existing XFS filesystem on LVM Logical Volume

Expand an existing XFS filesystem on LVM Logical Volume. ...

How to revoke specific key used to login with OpenSSH

Revoke specific key used to perform key-based login with OpenSSH utilizing simple public key revocation list or OpenSSH Key Revocation List (KRL). ...

How to determine which key was used to login with OpenSSH

Determine which SSH key was used to perform key-based login using public key fingerprint. ...

How to display message before OpenSSH authentication

Display message before OpenSSH authentication using simple built-in mechanism. ...

How to convert units using command-line

Use dedicated command-line utility to convert various units to different measurement systems. ...

How to display count and rate statistics for data read on standard input

Use wcs stream meter created by Arno Wagner to display count and rate statistics for data read on standard input. ...

How to manage remotely forwarded SSH authentication agent

Keeping SSH authentication agent in sync across multiple servers and terminal multiplexers is not an easy task, but can be solved by using consistent socket names used to connect to the SSH authentication agent. ...

How to parse INI configuration file using Bash

Parse INI configuration file using Bash shell-script. ...

How to attach to tmux session over SSH

Attach to the tmux session over SSH to continue your work. ...

How to store configuration within shell script

Store runtime configuration within shell script using simple but an effective method. ...

How to store the contents of every tmux pane

Store contents of every tmux pane using a shell script. ...

How to store the contents of tmux pane

Store contents of tmux pane to a file to keep the history or inspect recently executed commands. ...

How to solve pipeline mysteries

I have already described how to inspect a pipeline, but today I will show you how to write a shell script that will help you reconstruct a whole pipeline when all you got is a process ID that is part of the pipeline. ...

How to inspect a pipeline

A pipeline is a sequence of multiple commands separated by the control operators. It is easy to understand as long as you see the whole picture, but I will show you how to inspect it when you have a single process ID. ...

How to distinguish standard error from regular output

Use bash redirection and process substitution to programmatically distinguish standard error from regular output. ...

How to strace PHP-FPM processes

Isolate the problem and strace multiple PHP-FPM (FastCGI Process Manager for PHP) processes to identify the culprit. ...

How to match certificate and its intermediate counterpart

Match certificate and its intermediate counterpart by using X.509 key identifier extension. ...

How to display and verify certificate chain for specific domain

Use openssl utility to display and verify the certificate chain for a specific domain. ...

How to send output to multiple commands

Send output to multiple commands using tee utility and bash process substitution. ...

How to specify the same option multiple times using Bash

Write a simple Bash shell script that will allow you to specify the same option multiple times or provide multiple arguments to a single option. ...

How to count TCP connections

Use netstat, ss or files inside proc filesystem to count TCP connections. ...

How to generate sequence of numbers

Generate and print sequences of numbers to perform specific operations using command-line or shell script. ...

How to determine how long specified remote server or device was offline

Create a shell script to determine how long a specified remote server or device was offline. It is not designed to substitute monitoring solutions but to determine how long it will take to reboot the server or device. It is using convert seconds to human readable time code to display results. ...

How to query robots.txt

Query robots.txt using the robots.txt exclusion protocol implementation for Go language. ...

How to configure sysfs during system boot

Configure sysfs during system boot to apply custom configuration using a simple and convenient way. ...

How to disable Intel Turbo Boost

There are certain situations where I disable Intel Turbo Boost, for example to keep fans quiet during the night time. ...

How to capture column from command output and convert it to a row

Capture column from command output and convert it to a row to pass it further. ...

How to check website for broken links

Check website for broken links using HTTrack website copier. ...

How to copy website using HTTrack

Copy website for offline browsing using HTTrack website copier. ...

How to pretty print size in bytes using AWK

Pretty print size in bytes using AWK. ...

How to download OpenVPN configuration using NordVPN API

Download OpenVPN configuration using public NordVPN API to specific file. ...

How to avoid the two most common caveats when using read command

These are easy mistakes to make as the bash builtin read command will terminate with the error exit code on the end-of-file condition and use Internal Field Separator to split the line into words. It is kind of tricky, but it is worth knowing how to deal with such problems. ...

How to display memory used by processes in human readable form

Display memory used by processes in human-readable form using ps and awk utilities. ...

How to manipulate X clipboard from terminal

Manipulate X clipboard from terminal using xclip utility which is a command line interface to X selections to easily copy and paste text from terminal to GUI applications. ...

How to display your external IP address using NordVPN API

Display your external IP address using public NordVPN API. ...

How to drop kernel caches

Free dirty objects, page cache and reclaimable slab objects for troubleshooting or instructional purposes. ...

How to display user details using NordVPN API

Today, I will show you how to get and display user details using a shell script. This work is based on a Python-based solution by David Green and located at bitbucket/nordapi. ...

How to remotely execute shell function

Sometimes it is very convenient to define shell function and execute it remotely. ...

How to compare two files byte by byte

Compare two files byte by byte using cmp file comparison utility. ...

How to inspect Redis internals using UNIX socket and Python script

Inspect Redis internals using UNIX socket and Python script without external dependencies. ...

How to instantly add known_hosts entries for host and its IP address

Use simple shell function to instantly create known_hosts entries for specified host, including its IP address and remove outdated public host keys. ...

How to merge multiple known_hosts entries into single row

Global known_hosts file located in /etc/ssh/ssh_known_hosts and user managed ~/.ssh/known_hosts contains known host public keys. Due to its nature these files can contain multiple entries using the same key. It is not a problem, but merging entries using the same key is the first step that is necessary to inspect it visually and to verify host entries. ...

How to disconnect idle SSH clients

Disconnect idle SSH clients using built-in client alive mechanism. ...

How to monitor PHP-FPM pool

Monitor PHP-FPM (FastCGI Process Manager) pool using curl utility, cgi-fcgi application or slightly modified Python script that was used to display PHP-FPM pool information. ...

How to display PHP-FPM pool information using UNIX socket and Python script

Display PHP-FPM (FastCGI Process Manager) pool information using UNIX socket and Python script. I thought it would be easy to write a simple FCGI client. Apparently not, but it was an exciting and rewarding experience. ...

How to display PHP-FPM pool information using command-line utilities

Display PHP-FPM (FastCGI Process Manager) pool information using command-line utilities like curl or cgi-fcgi. ...

How to match certificate and its private key

Match certificate and its private key by comparing the modulus of the certificate to the modulus of the private key. ...

How to check external IP address using DNS service

I have already described how to check external IP address using curl or your own SSH service, but you can also use dig utility to take advantage of the OpenDNS, Google or Akamai DNS service. ...

How to move files based on specific time criteria

Use find a utility to move files based on specific time criteria. ...

How to mount exFAT filesystem

I am surprised that exFAT is not supported out of the box as it is a default filesystem used on SDXC cards. You need to install a FUSE-based implementation to access data on devices using it. ...

How to use public NordVPN API

In a blog post a month ago, I described how to use a terminal to display servers recommended by NordVPN, but the same result can be achieved by using public API service. It is not officially documented, so let’s play with it. ...

How to determine what is mounted and where

Determine what filesystem is mounted where, what is using particular options and how much free space is available. ...

How to use NordVPN command-line utility

Use NordVPN command-line utility to easily manage VPN service. ...

How to build package using directory structure and custom metadata

The simplest possible way to create a Debian package is to use defined package metadata and prepared target directory structure. ...

How to control status output of the dd utility

Control the amount of information printed out to standard error by the dd utility. ...

How to verify fstab file

Verify static filesystem information defined in the fstab file after applying modifications to ensure that system will boot without any problems. It is especially important in remote locations or places where you cannot easily perform emergency operations. ...

How to use terminal to display servers recommended by NordVPN

I have already described a simple way to manually configure Network Manager and automatically import NordVPN servers, so today, I will explain how to pretty print servers recommended by NordVPN using terminal instead of web-browser. ...

How to convert seconds to human readable time

Create a shell script to convert seconds to human-readable time. I have reused part of an old shell script used to pretty-print system uptime to built it, as this code proved to be useful on several occasions. ...

How to display calendar in terminal with Monday as the start of the week

cal is a nice utility that displays calendar in terminal, but there is a small problem that needs to be fixed as it uses Sunday as the start of the week. ...

How to disable onboard WiFi and Bluetooth on Raspberry Pi 3

Disable onboard WiFi and Bluetooth on Raspberry Pi 3 device. ...

How to free disk space from deleted but still referenced file

Very rarely and often by mistake, you can end up with a deleted file that is still used by some process, which is likely writing to it, so the used space cannot be freed. ...

How to detect chroot environment

Sometimes it makes me wonder whether I am inside a chroot environment or not, so let’s check it out. ...

How to define backup backend in HAProxy configuration

Define backup backend in HAProxy configuration to choose used backend depending on the number of usable servers. ...

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 schedule one-time task

Schedule a one-time task at a specific time or below defined system load using at utility. ...

How to force user to change password

Alter password expiry date to force user to change password on next login. ...

How to display output of multiple commands using columns

Execute paste utility to merge lines using tab character as a delimiter, expand to convert tabs to spaces, and column to format input into multiple columns. ...

How to extract rpm package on macOS

Extract RPM package on macOS to access its contents, which is especially useful for some old source packages. ...

How to display processes using the most CPU or memory

Display processes using the most CPU or memory using nothing more than basic Linux utilities. ...

How to create artificial package to circumvent dependency checking

Create simple artificial package to work around missing dependencies, ...

How to resolve hostname to IP address within a shell script

Create straightforward shell script to resolve hostname to IPv4/IPv6 address and reuse parts of it for other projects. ...

How to count separate line entries inside a pipe

Use a shell script to count separate line entries inside a pipe to see how many entries got filtered out. It can be useful in some scenarios, especially for testing. ...

How to aggregate weekly data to create custom statistics

Recently, I have parsed logs of several applications to generate custom weekly reports. It was a fascinating exercise. ...

How to create meta-package

Create simplest possible meta-package to install multiple software packages at once and quickly setup familiar environment. ...

How to display reverse package dependencies

Display reverse dependencies to inspect which packages depend on given application or library. ...

How to perform incremental backup using rdiff-backup

Perform simple incremental backup using rdiff-backup utility. ...

How to download in advance the public key used to sign repository signatures

There are those rare situations where you do not know the public key required to verify repository signatures but want to add a repository and a public key used to sign it. Hopefully, there is an easy answer to that question. ...

How to remove useless localizations

Install and configure localepurge package, which provides a fancy shell script to recover disk space used by useless localizations. ...

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 use content-disposition header to determine filename

Use Content-Disposition HTTP response header to determine filename and use it to store downloaded file. ...

How to download public key used to verify GnuPG signature for the repository

Configuring and using additional repositories requires APT public key management to validate the Release file and downloaded packages. ...

How to find a symbolic link by the target name

Find a symbolic link by the target name. It sounds simple and it definitely is. ...

How to calculate how fast data is copied to the specified directory

Determine how long it would take to copy data between directories. ...

How to verify file integrity using GnuPG signature

Verify file integrity using the GnuPG signature without touching your local GnuPG configuration. ...

How to compute and verify file checksum

Compute SHA message digest of a file to verify that its contents have not been altered. ...

How to create shell script for a cron job with hidden debug information

Create a shell script for a cron job with hidden debug information shown only when executed inside the terminal. ...

How to execute logrotate every hour

Logrotate does not support hourly schedule, but this is an easy task to accomplish. ...

How to locate directories that contain one or multiple files with particular content

Use find and grep commands to search for directories that contain one or multiple files with specific content. ...

How to display package dependencies

Display dependencies to inspect which packages are required for a given application. ...

How to enable HTTPS protocol for package managers using libapt-pkg library

Enable HTTPS (Hypertext Transfer Protocol Secure) for package managers using libapt-pkg library. ...

How to display upcoming events in Nextcloud calendar using shell script

Display upcoming events in the Nextcloud calendar using a custom shell script by extending the earlier ideas. ...

How to display upcoming events in Nextcloud calendar using text-based terminal emulator

Display upcoming events in the Nextcloud calendar using a text-based terminal emulator because it is fun and challenging. ...

How to use HTTP host header to choose HAProxy backend

Dynamically choose HAProxy backend depending on the HTTP host header, Lua programming language and environment variable. ...

How to detect and log changes in the list of mounted filesystems

Detect and log changes in the list of mounted filesystems (/proc/self/mountinfo file). ...

How to determine process execution time

Use GNU Bourne-Again SHell builtin or standalone time command to determine process execution time. ...

How to execute additional commands during system startup using cron

Use cron service to execute additional commands as the specified user using cron during system startup. ...

How to redirect every request to defined domain to particular location

Recently, I have moved my personal source code to GitLab. It rendered self-hosted git repository at repository.sleeplessbeastie.eu obsolete, so I have created simple redirection on HAProxy load balanced to cover this specific case. ...

How to store LeaseWeb data traffic in OpenTSDB time series database

Store LeaseWeb data traffic in OpenTSDB time series database using Python script, LeaseWeb API v2 and Python client to OpenTSDB. ...

How to use variable to choose HAProxy backend

Define and use a variable to dynamically choose HAProxy backend depending on the URL parameter, HTTP header field, and cookie value. ...

How to display LeaseWeb data traffic using API v2

LeaseWeb released a new version of API that will deprecate the old one, so it is the perfect time to update the Python script using v1 api and switch to API v2 before May 31. ...

How to securely change user password using shell script

Securely change user password using shell script to automate this task on these rare occasions. ...

How to execute older version of free utility

I have described the differences between the old and new free output format, so now I want to mention how to execute the former free version on Debian Stretch using LD_LIBRARY_PATH environment variable to temporarily substitute a different library for this particular execution. ...

How to block particular IP addresses on HAProxy

Block particular IP addresses on HAProxy load balancer using simple Access Control List. ...

How to determine if web-server still supports deprecated TLS 1.0 protocol

Use essential openssl utility to quickly determine if your web-server still supports deprecated TLS 1.0 protocol. ...

How to define basic authentication on HAProxy

Define basic authentication on HAProxy load balancer limit access to specific backends. ...

How to display dependencies for deb package

Use dpkg to pretty print package dependencies. ...

How to define allowed HTTP methods on HAProxy

Define allowed HTTP methods on HAProxy load balancer using simple Access Control Lists. ...

How to encrypt user password

Use encrypted passwords to automatically setup users using configuration management tools like Puppet or Ansible. ...

How to locally check SSL certificate

Check locally stored SSL certificate using essential utilities like openssl and curl. This knowledge is especially useful when you want to prepare an SSL certificate for a load balancer. ...

How to upgrade pip on Debian Wheezy

Debian Wheezy provides an ancient version of pip utility for installing Python packages. To put it very simply, it does not work anymore as it is not using HTTPS protocol, but fortunately this issue can be quickly fixed. ...

How to generate and decode CSR

Create a certificate signing request and use it to generate an SSL certificate. I strongly suggest reading my two earlier blog posts about self-signed SSL certificates and private keys as these contain useful information. I will describe three different ways to generate a certificate signing request. ...

How to parse free output to display available memory

The free utility is used to display the amount of free and used memory in the system. Debian Stretch provides an upgraded package. Output format has changed, and available memory is calculated using a different method, so let’s see what we can do with these modifications at this moment. ...

How to generate private key

Generate private key for an SSL certificate and verify its consistency. ...

How to query APT configuration

Query APT configuration to inspect specific options or create universal Debian utilities. ...

How to display fingerprint for public key file

It is very useful to know how to distinguish between different GnuPG public key files. ...

How to verify IPv4 address

There are many different ways to verify IPv4 address inside a shell script, but many of these are complicated or incomplete. I will describe a simple and verbose way to check IPv4 address using ipcalc utility. ...

How to display IPv4 network information

Display IPv4 network information for given address and netmask. Split networks, calculate subnetnetworks and supernetworks and convert address range. ...

How to display LeaseWeb data traffic using command-line

LeaseWeb provides an API that can be used to request information about servers and perform some maintenance tasks like update reverse DNS entries, null route IP addresses, reboot specific server or launch rescue/reinstallation process. I will show you how to request and display identifiable information about servers in each location including data traffic details. ...

How to manage known_hosts file using shell script

I am using a simple shell script to manage OpenSSL known_hosts file as it requires many small updates due to constantly changing host keys on a dynamic virtual server. ...

How to fix broken uwsgi package on Ubuntu Xenial

Recently, I tried to update uwsgi package on Ubuntu Xenial, but received an error about broken package. It looks like the mentioned package was pushed to the repository before its dependencies. This issue is thoroughly described in <a href=“https://bugs.launchpad.net/ubuntu/+source/uwsgi/+bug/1719363" target=_blank” rel=“external”>#1719363 bug report. ...

How to use backports repository

Backports repository provides packages for stable system that are recompiled from testing or unstable distribution. It is important to know that these packages are provided as is without any security support guarantee. ...

How to fix missing dirmngr

Debian Stretch provides gnupg in minimal installation as the package priority is set to important. The command is fully operational, but it requires dirmngr to perform network operations for managing and downloading certificates. ...

How to remove unused dependency packages

Remove package dependencies that are now no longer needed and configure system to perform this task automatically. ...

How to install missing init system helpers

The init-system-helpers package that provides a helper tools for all init systems is not available in primary Debian Wheezy repositories. You need to use wheezy-backports repository to install it on that operating system. ...

How to automatically control APT cache

Keeping an eye on a constantly changing APT cache can be quite tedious, so automate this task and free up your time to focus on other projects. ...

How to reverse text file

This is just a brief note on how to reverse a text file. It is not really useful for anything other than fun, but it is stuck in my head, so I need to write it down. ...

How to clear the APT cache

Clear the APT cache to reclaim disk space used by the downloaded packages. ...

How to disable the APT cache

Disable APT cache to conserve disk space on a small Debian based embedded system or a custom-built live USB system that can be easily booted. ...

How to execute CGI scripts using fcgiwrap

I am an enthusiast of the uWSGI project. You are still not limited to it as you can use fcgiwrap, a very lightweight and straightforward FastCGI wrapper for CGI scripts that do not require additional configuration. ...

How to mount WebDAV share

Nextcloud is a handy self hosted web-based application that can be used to store files, contacts and calendars. It provides the desktop and mobile client. In addition, it supports Web Distributed Authoring and Versioning protocol, so lets mount a WebDAV share. ...

How to display real destination URL

I am using curl to verify redirects and display real destination URL, and you should try it too. ...

How to upgrade lxd guests

It is time to mention about simple sequential or simultaneous upgrade process on lxd guests. It is adapted to Debian-like operating systems using apt as I am using these daily. ...

How to display HTTP response code

Use curl utility to verify the HTTP response code for the given URL. ...

How to assign an IPv6 address to an interface

Stop running away from this, request and assign an IPv6 address to an external interface to make content available over both IPv4 and IPv6. ...

How to post message from command-line into Slack

Use a defined webhook to post a message from the command-line as a parameter, standard input, or a file into Slack/Mattermost. Take advantage of colors, icons, and markdown to enhance your message. ...

How to display message provided from standard input or as a parameter

Today, I will create a simple proof of concept shell script to display the message provided from standard input or parameter. It could be used as a template to write shell scripts that can be executed in a pipe or as a standalone application. ...

How to display network connections using lsof and GNU awk

Two years ago, I described a simple way to display established TCP connections using ss command. Today I will use lsof and gawk to pretty print network connections. ...

How to test whether a number is prime

Perform test whether a number is a prime using command-line factor utility. ...

How to copy standard output and catch error code in the meantime

It is widespread to display and store command output using tee utility, but taking full advantage of it requires applying a slightly different error catching strategy. ...

How to use a parameter or standard input inside the shell script

Create a simple shell script that will read user message as a parameter or directly from standard input when used in the pipeline. ...

How to download files recursively

There is no better utility than wget to recursively download interesting files from the depths of the internet. I will show you why that is the case. ...

How to check Debian CVE status using python script

Check current status of Debian Common Vulnerabilities and Exposures using simple python script and Security Bug Tracker. ...

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 display process environment

Today, I will describe how to display environment variables associated with the running process. ...

How to remove invalid entries from known hosts file

There are rare cases when known hosts file becomes corrupted, so basic ssh utilities fail within custom built shell scripts due to ~/.ssh/known_hosts is not a valid known_hosts file error. ...

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

Let’s 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 import self-signed certificate to macOS system keychain

I described a simple way to generate self-signed SSL certificate using command-line two weeks ago. So, today I will share very useful trick for MacOS users which is a shell script to import self-signed certificate to macOS system keychain using command-line. ...

How to generate self-signed SSL certificate

Today I will show you how to quickly generate ready to use self-signed SSL certificate for nginx HTTP server using command-line. It is a very handy ability that will allow you to perform various tasks locally or in home laboratory without touching dedicated certificates. ...

How to verify package version in shell script

There are circumstances when you want to ensure a particular package version during the setup process. I will show you a simple method to verify the package version suitable for sourcing into a shell script. ...

How to determine when process was started

There are at least several ways to determine when the process was started to help you investigate and trace potential issues. I will briefly introduce four different methods to choose the most useful one. ...

How to get name of the source package

There are many applications that share the same source package, so I will show three different ways to print the name of the source package. ...

How to determine when the last time package index files were updated

Knowing how to determine when the last time package index files were updated can be beneficial when you least expect it. It is not something used every day but can be used to monitor or verify when apt-get update command was executed. ...

How to upgrade selected packages

It is very easy to upgrade the whole Debian system, but you can also upgrade only selected packages and skip the rest. ...

How to list available updates using apt

Many years ago I wrote How to display available updates blog post which mainly related to Debian Wheezy. Today I want to extend it by a neat console friendly utility available in Debian Jessie since the milestone apt release thanks to Michael Vogt. ...

How to automatically login user at the console

I have already described a straightforward way to automatically login user at the console without touching the graphical user interface using Debian Wheezy, so today I will post an update for Debian Jessie as the whole process has changed considerably. ...

How to check for command inside shell script

Today, I will illustrate a simple way to check for specific command inside a shell script, which is quite simple as it uses only shell built-in command utility. ...

How to check for package inside shell script

Today, I want to briefly describe a simple way to check for a specific package inside a shell script. ...

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 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 generate random password using command-line

I will show you how to generate a random password using the OpenSSL utility, standard command-line utilities, Password Generator (pwgen), and Automated Password Generator (APG). ...

How to change SSH private key passphrase

From time to time I have to update passwords used to secure private keys to keep myself a bit more sane. I will demonstrate simple and straightforward way to accomplish this task. ...

How to reload PostgreSQL configuration

Today, I will describe how to cause PostgreSQL clusters to reload their configuration files using four simple methods. ...

How to use The GNU Privacy Guard

The GNU Privacy Guard is an essential application when you need to ensure the confidentiality and origin of the information, so it helps to protect your privacy and the people you communicate with. ...

How to determine file system type

The more hard drives are lying around and the more you use them, then it becomes more important to know how to unambiguously determine file system type without mounting it. ...

How to temporarily disable user logins

Sometimes, I want to prevent regular users from logging into the system to perform more complex operations. To achieve that, I am using Pluggable Authentication Modules for Linux to temporarily disable user logins. ...

How to boot Debian ISO from USB flash drive

This is a follow up to the previous article. I will briefly describe a way to boot Debian installation ISO image from USB flash drive using syslinux bootloader. ...

How to create bootable USB flash drive

Today, I will show you how to create customized USB flash drive to boot selected ISO images using Syslinux bootloader for Linux ext4 filesystem. It is very handy and useful, so let’s begin immediately. ...

How to disable touchpad when external mouse is connected

I unconsciously keep my thumbs on built-in touchpad, so I decided to use external mouse and automatically disable touchpad for the time mouse is connected. ...

How to schedule system reboot

It is a short entry, but an useful one, as it is important to have a basic knowledge of how to schedule system reboot or power it down automatically at specified time. ...

How to access USB devices from within VirtualBox virtual machines

I constantly forget to add myself to the proper user group to access USB devices from within VirtualBox virtual machines, so I need to write it down. ...

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 set CPU governor at system boot

Currently, I am playing with recent Ubuntu Wily Werewolf on my personal notebook. The first thing I did after system installation was to configure CPU governor and set it at system boot. ...

How to crack password using Nvidia GPU

While this is not my primary area of expertise, I have been using John the Ripper more frequently lately, so I began to wonder how to take advantage of the powerful Nvidia GPU… ...

How to add new device to hddtemp database

Recently described hddtemp application does not contain every possible hard drive in its database. I’ll be honest here, its development stopped many years ago, but it is still very useful, so I will shortly describe how to add new hard drive to the database. ...

How to monitor hard drive temperature

It is often overlooked that hard drives which are available on the market provide temperature measurements. This temperature can be effortlessly monitored using hddtemp application by Emmanuel Varagnat. ...

How to extract the cover image from an e-book

I have successfully used Google Drive and Insync to organize all of the e-books that I have acquired during the last years. Currently plan to upload them to a personal DokuWiki instance since I use it more every day. Before I can start, I need to extract cover images to ensure that I will get a decent outcome. ...

How to use nearest Debian mirror

Today, I will explain how to automatically choose nearest mirror based on geographic and network location using Debian mirrors HTTP redirector to solve the common problem of choosing an appropriate mirror. ...

How to replace failed software RAID device

I had an unexpected incident last week as one of the hard disks in my server failed. This device was a part of a software RAID mirror, which created an opportunity to describe the whole process. ...

How to record terminal session

Maybe it is rarely needed, but recently, I found it very useful to know how to record an interactive session, so I could reference to it later or just examine it further. ...

How to lock Linux console session

It is easy to lock screen when using any of the available desktop environment or even basic X Window utilities. The more interesting thing is to achieve the same functionality on text only based system. ...

How to crack archive password faster

A week ago I wrote about a couple of interesting applications that can crack passwords, but they were not as fast as I thought. After investigating this topic further, I ended up using a community-enhanced version of John the Ripper. ...

How to crack archive password

I have recovered old backup only to learn that I do not remember password to the found archive. As a result, I checked out two command-line applications to crack passwords used to encrypt zip, 7z or rar archives. ...

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 terminate active ssh sessions

Several months ago I have shortly described how to close a non-responsive ssh session, which comes in handy at times. Today I will describe how to close every active ssh session by inspecting existing pseudoterminals. ...

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. ...

How to verify installed packages

I have unexpectedly experienced an issue with a couple of broken packages, which was easily solved using debsums utility. ...

How to search for files by date

Today I would like to tell you how to search for files by date, which is very useful skill when you spend most of your time on the command-line. ...

How to automatically logout user from the login shell after period of inactivity

I want to automatically log out the user from the login shell after a defined period of inactivity but leave X Window Terminals untouched. This will allow me to enhance security slightly, as I will not accidentally leave the superuser session running for a long time. ...

How to find orphaned files

It is easy to overlook orphaned files without an assigned existing owner or group after moving large amounts of data. Fortunately, it is easy to spot these files using the find utility. ...

How to store last command from history

I often want to save a recently executed command to the personal log file for further reference, so let’s do it. ...

How to check the progress of dd using proc filesystem

On Sunday 29th April 2012, I have described How to check dd’s progress using User-defined signal 1. Today, I will extend this topic further using the proc filesystem. ...

How to quickly and securely search for files

Using find command is not always the fastest way to search for specific files. The better method is to use mlocate utility, which uses its own file database and provides only user-accessible results. ...

How to locate scripts in the PATH

Simple shell script that will iterate through the directories in the PATH variable and print only files identified as scripts. ...

How to check external IP address

I am constantly on the move, so sometimes I need to quickly verify my external IP address, as I do not want to accidentally block myself on some kind of firewall. ...

How to verify copy process

Yesterday, I left a long-running copy process between two external USB hard-drives. I did not want to assume anything, so I created a simple shell script to ensure that the whole process went smoothly. ...

How to handle Bash history

I have already written a blog post about useful Bourne Again SHell key sequences, so today, I will touch on another important aspect of the daily routine – the history. ...

How to handle Bash command-line

The default interactive shell in Debian is Bourne Again SHell, so it worth to invest some time to at least skim through the available readline key sequences to gain higher proficiency at the command-line. ...

How to check whether the process ID still exists

Not well documented, but a quick and simple operation. ...

How to get PID of the background process

It is a very simple operation that can be effectively used inside shell scripts. ...

How to compare the contents of two directories

This weekend I encountered a simple, but interesting topic, which concerns comparing the contents of two directories. The fun part is that you don’t need any additional utilities as standard diff command is fully sufficient. ...

How to extract an ISO image

During my recent activity I have noted to check out how to extract an ISO image in a traditional way using only shell utilities. It turned out to be easier than I thought, so I will present you three different solutions. ...

How to forbid script execution from different directory

Today I have found an interesting issue as I tried to forbid shell script execution from different directory. ...

How to terminate SSH connection

Currently, I am working over an unstable network connection, so my SSH session is constantly disconnected. It is very uncomfortable situation as dropped SSH connection freeze the whole terminal. ...

How to archive every directory in current location

Today I needed to archive every non-hidden directory in several different locations. I do not like to repeat myself so after a while I quickly created shell script to accomplish this task. ...

How to count local user accounts

If you are wondering how to count only local users ignoring system accounts, I will give you a concise and straight answer. ...

How to remotely check PostgreSQL version

Today I will shortly describe how you can remotely check the PostgreSQL version and use it inside shell scripts. This ability comes in handy at times, as it can be used to perform different tasks depending on the returned database version. ...

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 reliably use Serial port within the local network

The easiest way to reliably use Serial port within the local network is to use RS-232/422/485 NPort Device Server produced by Moxa company. I will shortly describe how to install NPort 5110 (1-port RS-232 serial device server) on Debian Wheezy. ...

How to upload Jekyll blog to the Gandi Simple Hosting

I am using Jekyll to generate this website for a half a year and Gandi for an even longer period of time so at the beginning of this year I revisited How to quickly download or upload directory tree over FTP post and created simple but useful shell script to automate build and upload process. ...

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 deal with dmesg timestamps

By default dmesg command print kernel ring buffer using the timestamp for each logged message. It is easy to change this behavior and display date/time in a human-readable form using just one additional parameter. Still, sometimes it is not supported, so I will shortly touch upon this topic. ...

How to accurately determine when the system was booted

It is very easy to tell how long the system has been running using uptime command, but the information when exactly it was booted is not so apparent, so I will show you two different ways to get it. ...

How to automatically login user at the console

Whenever I see auto-login feature implemented by using X login manager, I immediately think about how to automatically login user at the console without even touching graphical user interface. ...

How to tell to which package the specified file belongs to

It is good to know how to tell to which package the specified file belongs to as this knowledge could be very useful during system upgrade or unexpected system failure. ...

Handy way to beep within a shell script

Sometimes I need to explicitly indicate execution of specified shell script or just action taken inside it. My favorite way is to use advanced pc-speaker beeper, which is directly available in Debian repository. ...

How to check last mount time of the ext2/ext3/ext4 filesystem

A couple of days ago, I was asked how to check the last mount time of the ext2/ext3/ext4 filesystem. The solution is straightforward as it does not require anything more then tune2fs utility. ...

How to display available updates

It is straightforward to display available updates using an application with a graphical user interface, but not so obvious to do it by using shell commands only. I will shed some useful light on the subject so we could both benefit from it. ...

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. ...

How to list local displays

I was always curious about how to list local displays as it is quite interesting issue. Solution is not immediately apparent, but easy enough to spot after a while as it does not require anything more than little observations. ...

Debian – How to hold specific package

There are at least couple ways to hold specific package and prevent it from being updated as you can use apt, dpkg, aptitude, dselect, apt preferences, but only the last one is effective in every case. ...

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 open manual page at the specific page section

After writing the previous blog entry, I started to think about how to specify page section when opening the manual page. It is a simple but quite interesting issue, so I quickly got curious and wrote this post to describe a straight solution. Just to be clear – I need to mention that I am not writing about section numbers describing distinct subject areas but just page sections, such as NAME, SYNOPSIS, DESCRIPTION, AUTHORS, and so on. ...

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. ...

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 read total CPU usage of the group of processes

I was wondering how to read the total CPU usage of the group of processes. Then I came with a straightforward solution using top and awk commands. ...

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 get number of days in a month using shell commands

Today I was writing a shell script that performs different actions depending on the day of the month. Nothing fancy but then I came across an interesting issue, which is how to get number of days in a month. I got interested and started playing with shell commands, namely cal and awk utilities. ...

How to re-read partition table

Re-read partition table without machine reboot using partprobe utility which is a part of parted package. ...

Semi-intelligent screensaver

A couple of days ago, I described a couple of interesting ways to interact with KDE using the D-Bus message bus. Today I will show how to set up a semi-intelligent screensaver to just wait during YouTube video playback. ...

How to automate KDE using D-Bus

Today I was playing with D-Bus message bus and KDE so I will describe here couple of basic actions that can be quickly automated by using shell commands. It shouldn’t matter much but I need to mention that I am using KDE 4.9.5. ...

How to quickly maximize particular window

Around three weeks ago I wrote an article on how to automate mouse and keyboard. It was very fun experience but as the former article was quite long I didn’t mentioned about wmctrl tool. It is an excellent complement to the previously described tools. ...

How to automatically wake up notebook

I came across ACPI wakeup wiki article while writing previous post, got interested and checked how to automatically wake up notebook. It is really simple as you can quickly set wake up time using date command, just remember to use Unix time. ...

How to automate mouse and keyboard

Recently I was wondering if it would be possible to automate mouse and keyboard actions. The answer is obviously yes as you can use xautomation and xdotool tools. I will describe them in a couple of simple examples. ...

How to change the MAC address of an Ethernet interface

Change the MAC address of an Ethernet interface and make this change permanent. I will briefly explain how to do this using standard commands and one particularly useful tool MAC Changer. ...

How to automatically set up external monitor

Recently I was wondering how to automatically set up an external monitor without using desktop utilities as I don’t like to configure it each time. This question provided me a lot of fun as it opens a couple of interesting possibilities. ...

How to monitor battery capacity

Recently battery in my notebook started to behave erratically. It will charge only to 70-80% of its maximum capacity. I suspect that it is probably slowly dying, so I will have to replace it soon, but at first, I will look at several utilities to monitor battery capacity. ...

Debian – How to turn off the system bell

It is very annoying to hear loud beeps at home especially at night or when listening to music. To turn off the system bell just follow a couple of steps below and enjoy pure silence. ...

Debian – How to transparently bridge Ethernet interfaces

Yesterday, I wrote a short note about VLAN interfaces. Today, I want to write a short entry on how to bridge Ethernet interfaces to keep things complete as I need to mention about creating ACCESS port to tag packets on desired interface. ...

Simple shell script to backup MySQL databases

Simple shell script to backup MySQL databases. ...

Debian – How to read DHCP packets

I am playing with DHCP option 82 so I need to read DHCP packets. The easiest way to do this is to use dhcpdump by Edwin Groothuis because of very simple usage and friendly output. ...

Debian – How to change time zone

This is rarely performed task but an easy one. To change time zone you need to reconfigure tzdata package. ...

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. ...

Debian – How to replicate data over network using GlusterFS

Recently I needed to replicate data between two Linux servers so I could mitigate potential hardware failure. To achieve this goal I used GlusterFS – an Open Source distributed file system. In this example I will use Debian Wheezy as I want to try more recent version of GlusterFS. ...

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. ...

Ubuntu Precise – Install youtube-dl package using Quantal repo

Ubuntu Precise 12.04 currently contains in repository youtube-dl version 2012.02.27-1. As of recent YouTube changes this package version is not usable anymore but there is an updated version in Ubuntu Quantal 12.10 repository. To use it you need to perform couple of steps described below. ...

How to generate QR Codes

Quick Response Codes are appearing everywhere. You can see them in museums, near the tourist attractions or all over the web. There is no doubt that QR Codes are useful as they can contain any information within reasonable limits. ...

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. ...

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. ...

Ubuntu – How to use persistent encrypted partition

Simple solution using Linux Unified Key Setup. ...

How to backup DOS-type partition table/GPT and LVM metadata?

DOS partition table We can use sfdisk to dump partition table in usable format and store it: $ sudo sfdisk -d /dev/sda > sda_partitions Partition table can be restored using stored backup: $ sudo sfdisk /dev/sda < sda_partitions Partition table can be easily cloned (from sda to sdz in this example): $ sudo sfdisk -d /dev/sda | sfdisk /dev/sdz GPT To backup GUID partition table use sgdisk command (from gdisk package):...

How to get disk UUID

I recently needed to know the UUID (universally unique identifier) of my bootable USB root partition. It is a better way to distinguish storage devices because device names can change depending on the connection order. ...

How to mount software RAID1 member using mdadm

Just a moment ago I connected my old hard drive and realized that it was a RAID member. ...

Boot to RAM notes

This post contains notes on this topic in the form of a concise guide. ...

How to check the progress of the dd process

Check the progress of the dd process. ...

How to quickly download or upload directory tree over FTP

The fastest way to download or upload directory tree over FTP using just plain console is to execute lftp command. ...

How to convert Mbox mailboxes to Maildir format

Download mb2md.pl script and run as described in manual. For example to convert /old/mbox to /new/maildir you can execute: # perl ./mb2md.pl -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 quickly create rewrite rules for all WordPress posts

This post describes a quick way to create .htaccess rewrite rules after permalinks change from /%post_id% to /%year%/%monthnum%/%day%/%postname%/ ...

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 check established TCP connections

Display established TCP connections inside the terminal. ...

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 ....

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… ...

How to install *.deb package in Ubuntu?

If you downloaded *.deb package and wonder how to install it then just look at the snippet posted below. ...

Create web thumbnail for SemanticScuttle using cutycapt

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

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. ...

How to do some work in each active jail (FreeBSD7)

Execute a set of commands inside each active jail. ...

Simple script to create new jail in FreeBSD

Create shell script to create image based jail in FreeBSD 7. ...

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. ...

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. ...