Category Archives: Linux

Example Linux server error logs when CPU is faulty

Error messages displayed in the SSH shell: Message from syslogd@server at Aug 8 11:27:49 … kernel:[4665156.435610] NMI: IOCK error (debug interrupt?) for reason 61 on CPU 0.   Message from syslogd@server at Aug 8 11:28:08 … kernel:[4665175.398187] NMI: IOCK error (debug interrupt?) for reason 61 on CPU 0.   Message from syslogd@server at Aug 8 […]

Output multiple Linux commands into columns

You can run multiple Linux commands and get the output for each command delimited by a column: paste -d’|’ <(echo "$VAR1") <(echo "$VAR2") <(echo "$VAR3") <(echo "$VAR4")paste -d’|’ <(echo "$VAR1") <(echo "$VAR2") <(echo "$VAR3") <(echo "$VAR4") You can also run commands “inline” inside $(), example: paste -d’|’ <(echo $(pwd)) <(echo $(id))paste -d’|’ <(echo $(pwd)) <(echo […]

Get Server IP Address with Ifconfig and IP in Bash

Here is a one-line command to get server remote IP address: Using “ifconfig” checking for “inet”: /usr/sbin/ifconfig | grep "inet " | cut -d: -f2 | awk ‘{ print $2}’ | head -n 1/usr/sbin/ifconfig | grep "inet " | cut -d: -f2 | awk ‘{ print $2}’ | head -n 1 Using “ifconfig” checking for […]

bash: ipconfig: command not found

If you get an error when typing “ifconfig” in the shell console: bash: ipconfig: command not foundbash: ipconfig: command not found Then try to use the full ifconfig path: /usr/sbin/ifconfig/usr/sbin/ifconfig Or better use “ip” command like this: ip addrip addr

Check if a number is within a range in bash

Bash snippet to check if a number is within a range: number=3   if [ "$number" -ge 2 ] && [ "$number" -le 5 ]; then echo "$number is within 2 and 5" finumber=3 if [ "$number" -ge 2 ] && [ "$number" -le 5 ]; then echo "$number is within 2 and 5" fi

Linux Commands to Check HDD from Rescue Mode

Linux commands you can run to check HDD status from Rescue Mode: 1) List disks ls -la /dev/sd* ls -la /dev/md*ls -la /dev/sd* ls -la /dev/md* 2) Try to mount a disk mkdir -p /mnt/md0 mount -t auto /dev/md0 /mnt/md0mkdir -p /mnt/md0 mount -t auto /dev/md0 /mnt/md0 3) Check RAID status with MDADM mdadm –detail […]

Compare Numbers and Integers in Bash

Here is an example bash script to compare numbers: #!/bin/bash   a=123456 b=123456   if [ "$a" -eq "$b" ]; then echo "Numbers are equal"; fi#!/bin/bash a=123456 b=123456 if [ "$a" -eq "$b" ]; then echo "Numbers are equal"; fi Here are all comparison operators: -eq # equal -ne # not equal -lt # less […]

Get Number of CPU Threads on Linux Debian

You can get the number of CPU threads with this command: nproc –allnproc –all Here is an example output on an AMD Ryzen 5 3600 Hexa-Core: 1212 That is correct, the AMD Ryzen 5 3600 has 12 threads. The command supports also multi-sockets servers. Get number of CPU cores

Get Number of CPU Cores on Linux Debian

Get the correct number of CPU cores on a Linux Debian server: grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2 | awk ‘{s+=$1} END {print s}’grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2 | awk ‘{s+=$1} END {print s}’ Here is an example output on an AMD Ryzen 5 3600 Hexa-Core: 66 That […]

Install Required Fonts for Puppeteer

Install required fonts (i.e Asian fonts) for Puppeteer: apt-get -y -q install xfonts-encodings xfonts-intl-asian xfonts-utils   apt-get -y -q install fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf fonts-ubuntu-title fonts-liberation   mkfontscale && mkfontdir && fc-cacheapt-get -y -q install xfonts-encodings xfonts-intl-asian xfonts-utils apt-get -y -q install fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf fonts-ubuntu-title fonts-liberation mkfontscale && mkfontdir && fc-cache […]