Category Archives: Linux

Exclude Packages from Apt-Get Upgrade on Debian Linux

To exclude/hold a package from apt-get upgrade type: apt-mark hold package_nameapt-mark hold package_name For example, to exclude MariaDB mysql packages type: apt-mark hold libmariadbclient18 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mysql-commonapt-mark hold libmariadbclient18 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 mysql-common Here is an example output: libmariadbclient18 set on hold. mariadb-client-10.3 set on hold. mariadb-client-core-10.3 set […]

What to Select on GRUB-PC Configuration “Install Devices”

Today when I did an “apt-get dist-upgrade” I received this: Looks like GRUB-PC was updated and now it asks: What do you want to do about modified configuration file grub?What do you want to do about modified configuration file grub? I selected “Keep the local version currently installed”. Then it happeared another window asking this: […]

E: Could not get lock /var/lib/dpkg/lock

If you get the following error while doing apt-get upgrade: E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is […]

Get the Output of a Program in a Variable in Bash

Do you need to get the output of a program in a variable in Bash? There are two simple ways to achieve that: var=`./run.sh params`var=`./run.sh params` Or alternatively you can use $(), i.e: var=$(./run.sh params)var=$(./run.sh params) Remember to not put spaces before or after the = operator. If you need to capture also error messages […]

Capture Multiple Line Output Into a Bash Variable

Lets say you have a bash script “run.sh” that outputs multiple lines, i.e: line1 line2 line3line1 line2 line3 You capture the script output in a bash variable like this: OUTPUT=$(/root/run.sh)OUTPUT=$(/root/run.sh) Now pay attention on how you echo the output: Echo Variable Without Double-Quotes If you echo the variable without the double-quotes: echo $OUTPUTecho $OUTPUT It […]

How to Extract Domain from URL in Bash

Using awk you can extract a domain name from an URL: echo http://example.com/index.php | awk -F[/:] ‘{print $4}’echo http://example.com/index.php | awk -F[/:] ‘{print $4}’ The output is: example.comexample.com

Get Local File Permissions from Command-Line on Linux

Using stat command you can get local file permissions: stat -c "%a %n" /path/to/file/or/folderstat -c "%a %n" /path/to/file/or/folder Here is an example output: $ stat -c "%a %n" ./Documents/Testing.html 664 ./Documents/Testing.html$ stat -c "%a %n" ./Documents/Testing.html 664 ./Documents/Testing.html Details about the stat parameters: %a Access rights in octal %n File name%a Access rights in octal […]

Automatically Renew Let’s Encrypt Certificates (Nginx)

Here I made a simple bash script that automatically renew all Let’s Encrypt certificates and reload Nginx only once, if at least one certificate was renewed successfully: #!/bin/sh   # ===DESCRIPTION # This script is used to renew Let’s Encrypt certificates via certbot # And reload Nginx web server only once if at least one […]

libX11-xcb.so.1: cannot open shared object file: No such file or directory

While I was installing Node.js Puppeteer I got this error: /usr/lib/node_modules/puppeteer/.local-chromium/linux-672088/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory/usr/lib/node_modules/puppeteer/.local-chromium/linux-672088/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory To fix this issue just install the required libraries: apt install -y […]

FATAL:zygote_host_impl_linux.cc(124)] No usable sandbox

If you get this error when you run Chrome on Linux Debian: FATAL:zygote_host_impl_linux.cc(124)] No usable sandbox! Update your kernelFATAL:zygote_host_impl_linux.cc(124)] No usable sandbox! Update your kernel Then you need to type the following commands to fix it: echo kernel.unprivileged_userns_clone=1 > /etc/sysctl.d/00-local-userns.conf service procps restartecho kernel.unprivileged_userns_clone=1 > /etc/sysctl.d/00-local-userns.conf service procps restart