Technical Blog by Tomasz Muras Technical Blog
  • Search
Navigation bar avatar
✕

    Linux

    • How to wait for process to finish in bash and check its exit code?

      Posted on September 8, 2023

      We want to run some process in the background and continue script execution. Then at some point we want to stop and wait for this process to finish. We also want to capture the exit code of this process. Once we have PID of the process we put in background,… [Read More]
      Tags:
      • bash
      • linux
    • How to find fonts that render glyph for given unicode character.

      Posted on May 7, 2023

      I want to find all fonts that support Polish accented characters (ąćęłńóśżź). [Read More]
      Tags:
      • linux
    • Limit process CPU use with cgroups version 1 and cgroup tools

      Posted on September 22, 2022

      The results with cfs_quota_us=50000 are below. The top utility shows about 50% CPU usage. [Read More]
      Tags:
      • cgroups
      • linux
    • Enforce memory limit in systemd service

      Posted on September 1, 2022

      Create new service with MemoryHigh and MemoryMax directives. [Read More]
      Tags:
      • systemd
      • linux
    • Enforce process limit in systemd service

      Posted on August 30, 2022

      Simplest possible service that runs /root/process.sh script: [Read More]
      Tags:
      • systemd
      • linux
    • How to list all TCP/IP connections ordered by IP and count

      Posted on May 19, 2022

      How to list TCP/IP connections per remote IP, ordered by count: [Read More]
      Tags:
      • security
      • linux
    • Troubleshooting HTTPS with openssl

      Posted on May 18, 2022

      Display certificate information: [Read More]
      Tags:
      • security
      • linux
    • ranger file manager cheatsheet

      Posted on January 9, 2022

      Cheatsheet for ranger - a console file manager with VI key bindings, based on heroheman. [Read More]
      Tags:
      • linux
      • cheatsheet
    • URL-dependent load balancing with HAProxy

      Posted on December 15, 2017

      We have a typical web application that is deployed behind a load balancer with several web servers behind. The web servers are nearly identical - running the same OS, code, packages. But they do differ in one way - some have a quick access to the external asset’s repository. Other… [Read More]
      Tags:
      • linux
      • virtualization
      • moodle
    • systemd PrivateTmp with Apache on Ubuntu 17.04

      Posted on December 6, 2017

      Apache service on Ubuntu 17.04 is configured by systemd with PrivateTmp=true option. You can see it in: [Read More]
      Tags:
      • linux
      • ubuntu
      • apache
    • How to detect user’s home directory from PHP on Linux & Windows

      Posted on October 22, 2012

      I needed to locate current user’s home directory, to find and parse a config file like ~/config.ini. The current user is a user that is currently running a PHP CLI script. I have found a neat solution in drush, ready to copy & paste into your function: [Read More]
      Tags:
      • php
      • linux
    • Redirect output of a script from the inside of it

      Posted on October 8, 2012

      Normally, when you want to redirect (standard) output of a script to a file, you run it with a redirection, like: [Read More]
      Tags:
      • linux
    • Include additional local files from .zshrc

      Posted on September 25, 2012

      I try to keep the same .zshrc dotfile on all the machines I use. I store the “master” copy in SVN, so any improvements I make can easily go to other computers. However, some parts of zshrc configuration only make sense for particular machine. To keep one common master copy but… [Read More]
      Tags:
      • linux
      • zsh
    • Extract the content from the documents and make it searchable with solr 4

      Posted on September 23, 2012

      solr can be easily extended to handle binary files and extract the information from them. Apache Tika library is used for the file analysis. [Read More]
      Tags:
      • linux
      • solr
      • ubuntu
    • Limit bandwidth for a service

      Posted on May 14, 2012

      To test a performance of multiple parallel file downloads, I had to make sure that a download takes significant amount of time. I could use huge files but that’s not very helpful if you work on a local, 1Gb LAN. So I’ve decided to limit download speeds from my Apache… [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
    • Monitoring of Tomcat with VisualVM and VisualGC

      Posted on May 5, 2012

      Sometimes it can be useful to monitor performance of Java Virtual Machine (VM) on remote host. To do so, a very nice tool – VisualVM – can be used. It can be run on local host and get information from jstatd running on a remote host. In addition, VisualVM comes… [Read More]
      Tags:
      • java
      • linux
      • tomcat
    • git server with apache authentication on Ubuntu Debian

      Posted on April 6, 2012

      This guide will describe how to serve git repository on HTTP port using Apache. This should work on any recent Ubuntu or Debian release, I’ve tested it on Ubuntu Server 11.10. I’m setting it up on my local server 192.168.1.20 under git/agilesparkle, so my repository will be available at http://192.168.1.20/git/agilesparkle.… [Read More]
      Tags:
      • git
      • linux
      • ubuntu
      • debian
    • Change the location of zim notebooks

      Posted on February 26, 2012

      Zim is a desktop wiki I highly recommend. Recently I’ve switched to another desktop and after copying my whole home directory, zim default notebooks did not open anymore. This was because I’ve changed my username, which has caused a change in the location of my zim notebooks. This can be… [Read More]
      Tags:
      • linux
      • zim
    • Install soapUI on Ubuntu 11.10

      Posted on January 26, 2012

      This post describes how to install soapUI on Ubuntu 11.10 and solve potential issues with installation. [Read More]
      Tags:
      • java
      • linux
    • Show full path to the current file in vim

      Posted on January 3, 2012

      I find this one very useful, when you press just CTRL-G in vim you will get some basic file information: [Read More]
      Tags:
      • linux
      • debian
      • ubuntu
    • xargs, find and escaping pipe and semicolon

      Posted on December 29, 2011

      I wanted to iterate over set of directories and calculate total number of files inside each of them (recursively). xargs & find would do it just fine but you can not easily escape pipe inside xargs command. Here is the solution: [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
      • bash
    • Send email from command line without x-mailer tag

      Posted on December 17, 2011

      I usually set my postfix to relay via gmail SMTP to allow me for reliable external email delivery from my gmail address, with the convenience of the command-line. To send an email using mail utility I can simply use: [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
    • ext2 ext3 partition block group error

      Posted on August 29, 2011

      Here is the error from dmesg I’ve got when trying to mount external HDD: [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
    • Recursively find the latest updated file

      Posted on August 20, 2011

      Here is the command: [Read More]
      Tags:
      • linux
      • ubuntu
      • debian
    • Automatically equalize brightness of several images

      Posted on August 14, 2011

      I have a collection of 160 photos that I would like to montage into a movie. Each photo was done on a different day and the brightness of each photo varies. This will definitely not look good on the photo, so I’ve decided to “normalize” the brightness across the images.… [Read More]
      Tags:
      • debian
      • ubuntu
      • linux
      • bash
    • How to find the widest image

      Posted on August 12, 2011

      Recently I had to locate the widest image in the set of photos in a directory. Here is how you can easily do it with identify command, from ImageMagick suit: [Read More]
      Tags:
      • linux
      • ubuntu
      • debian
      • bash
    • Resize images in bulk to the same width or height, same aspect

      Posted on August 9, 2011

      mogrify is the tool you are looking for – it comes with the great imagemagick package and it’s designed especially to be used for bulk operations. To resize all images in current directory to 600 pixels wide (width): [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
      • bash
    • Bulk rename photos to date

      Posted on August 4, 2011

      I have a collection of related photos stored on my PC. The filenames were “ugly” – standard file names coming from the photo camera. I would like to rename them into a file containing the date when the photo was shoot, e.g. 2011.07.21.jpg. There is an excellent commandline tool to… [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
      • bash
    • Recursively find total size of selected files-directories

      Posted on June 28, 2011

      Sometimes simply checking the size of the whole directory is not enough, and you need more information, e.g. the whole directory has 3GB – but how much of it are those .avi files inside? The most flexible way for matching the files (or directories) is by using find command, so… [Read More]
      Tags:
      • debian
      • linux
      • ubuntu
      • bash
    • Get next auto_increment value in MySQL

      Posted on June 12, 2011

      I was recently working on some MySQL 5.5 performance testing. I had to generate a lot of SQL queries I would then use for my testing. To make my tests repeatable I needed to hardcode the values for IDs. That is, I couldn’t simply use: [Read More]
      Tags:
      • mysql
      • linux
      • php
    • Master slave replication in MySQL 5.5

      Posted on May 21, 2011

      I’d like to share a quick guide on how to set up master/slave replication for the MySQL 5.5 server. The procedure below should be used for development/testing only. If you want to create a production-ready setup, you should follow instructions from MySQL official documentation or use MySQL server packaged by… [Read More]
      Tags:
      • linux
      • mysql
    • utf-8 with perl odbc, freetds, and ms sql server

      Posted on April 16, 2011

      to make perl properly handle utf-8 strings inserted and retrieved from ms sql database, freetds config must be used (the configuration with only odbc.ini is possible to make perl connect to a database, but i could not find any way to make it work with utf) [Read More]
      Tags:
      • linux
    • Quit less without cleaning the screen

      Posted on April 7, 2011

      Normally when you quit less, your screen will be redrawn and you will be back with the content you could see on your screen before using less. Sometimes though it’s very handy to see the file with less, scroll down to the fragment of your interest and have that fragment… [Read More]
      Tags:
      • linux
      • bash
      • shell
    • scubed howto

      Posted on September 4, 2010

      0. http://cube.dyndns.org/~rsnel/scubed/  (scubed_http) 1. svn checkout http://cube.dyndns.org/svn/scubed/trunk scubed; # get scubed 2. make, su, make install, scubed -V 3. there’s a README file, in the scubed/ directory and on the web-site. basically all is written there  (scubed_readme) 4. it will be a file used, for demonstration purpose. but a real life target is a… [Read More]
      Tags:
      • linux
      • security
    • cached plan must not change result type

      Posted on May 26, 2010

      An interesting error that may happen in PostgreSQL when using prepared statements is: [Read More]
      Tags:
      • linux
      • postgresql
    • Parallel downloads with wget

      Posted on May 21, 2010

      How to download a list of URLs using more than one process (say wget) at the time? First, create a file with URLs – one URL per line. Let’s call the file url.txt. Then we need to create N wget processes, each downloading one URL at the time. Thanks to xargs… [Read More]
      Tags:
      • linux
      • bash
      • wget
    • Upgrade all packages but one

      Posted on May 17, 2010

      To upgrade nearly all packages with apt-get but “hold” some of them at the current version, you can use dpkg. Let’s say I would like to upgrade my Debian or Ubuntu system with apt-get and here is what I’m getting: [Read More]
      Tags:
      • apt
      • dpkg
      • linux
    • How to block HTTP requests for specific method

      Posted on May 16, 2010

      I needed to set my Apache Web Server to ignore/block all the HEAD requests but respond to GET requests normally. It is very simple with the mod_rewrite, for instance this can be added to .htaccess: RewriteEngine On RewriteCond %{REQUEST_METHOD} HEAD RewriteRule ^.*$ - [F] Second line: [Read More]
      Tags:
      • linux
      • apache
    • Dynamic MMap ran out of room

      Posted on February 9, 2008

      Increase the maximum allocated memory in your /etc/apt/apt.conf. Add this line if it does not exist (also create /etc/apt/apt.conf if necessary): [Read More]
      Tags:
      • apt
      • debian
      • ubuntu
      • linux
    • Convert and extract ISO, DAA and BIN image formats in Linux

      Posted on November 18, 2007

      One way to do it (I think it’s the only way for DAA proprietary file format) is to use Linux version of PowerISO. [Read More]
      Tags:
      • linux
      • iso
      • bin
    • Howto mount ISO image in linux

      Posted on November 18, 2007

      Log in as root [Read More]
      Tags:
      • linux
      • iso
    • fast reboot with kexec

      Posted on November 22, 2006

      (bios) stage and that bootloader stage when we have a nice lilo/grub prompt. [Read More]
      Tags:
      • linux
      • kernel
    • ipp2p and connlimit kernel patches for 2.6.17

      Posted on November 22, 2006

      1) download a recent patch-o-matic [Read More]
      Tags:
      • linux
      • kernel
    • usb mass storage howto

      Posted on November 15, 2006

      enable following options in the kernel: [Read More]
      Tags:
      • linux
      • kernel
      • usb
    • KDE keyboard shortcuts

      Posted on August 6, 2006

      [Read More]
      Tags:
      • linux
      • kde

      Tomasz Muras  •  2026

      Powered by Hugo, styled with Beautiful Jekyll