BASH - Check IP is in range of ip pools I have a list of IPs in MAXCDN_ARRAY to be used as whitelist. I want to check if a specific IP address is in range in this array. How can I structure the code so that it can compare all IPs in the array and say the specific IP in in range of this list or not? GrepCIDR You can use grepcidr to check if an IP address is in a list of CIDR networks. Linux Bash Development
How to Test an SMTP Server with Telnet command line How to test SMTP and IMAP servers using the telnet command-line Linux Networking Windows
How disable swap in debian or linux system swappiness Swappiness is a Linux kernel parameter that controls the relative weight given to swapping out runtime memory, as opposed to dropping pages from the system page cache . Swappiness can be set to values between 0 and 100 inclusive. A low value causes the kernel to avoid swapping, a higher value causes the kernel to try to use swap space. The default value is 60, and for most desktop systems, setting it to 100 may affect the overall performance, whereas setting it lower (even 0) may decrease response latency. Debian Linux
pnp4nagios and icinga2 This is not my article, it is copy from this site . It cover install icinga2 , icinga2 director and pnp4nagios on Ubuntu 20.04, but is very useful as manual for debian buster and Bullseye. This guide shows how to install Icinga2 monitoring software on Ubuntu 20.04 – this includes backend, frontend, director and pnp4nagios (adding graphs to icinga). Especially PNP was hard to get working – but if you follow the guide everything is nicely lined up at the end. Linux Monitoring
Linux Command Line Tips and Tricks Text Editing For mostly all examples we use sed utility with substitution command. The syntax is pretty simple: sed -i 's/SEARCH-WORD/REPLACMENT-WORD/gI' input # or for regular expressions: sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gi' input The -i option edit and update text file in place. For piped input from another utility it is not necessary The / are delimiters between words or regexp. sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gI' - I flag make search case insensitive sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gI' - for text files input use g flag to make search global across the whole file print first N chars We want print first N chars. Linux
cut command in linux with examples The cut command is a command-line utility for cutting sections from each line of a file. It writes the result to the standard output. It’s worth noting that it does not modify the file, but only works on a copy of the content. Although typically the input to a cut command is a file, we can pipe the output of other commands and use it as input. It can be used to cut parts of a line by byte position, character and field. Linux Linux Utilities
Arpwatch - monitor mac addresses change Arpwatch Arpwatch is an open source computer software program that helps you to monitor Ethernet traffic activity (like Changing IP and MAC Addresses) on your network and maintains a database of ethernet/ip address pairings. It produces a log of noticed pairing of IP and MAC addresses information along with a timestamps, so you can carefully watch when the pairing activity appeared on the network. It also has the option to send reports via email to an network administrator when a pairing added or changed. Networking Linux Security
Awk BuiltIn Variables The following is a list of variables that awk sets automatically on certain occasions in order to provide information to your program. The variables that are specific to gawk are marked with a pound sign (#). These variables are gawk extensions. In other awk implementations or if gawk is in compatibility mode (see section Command-Line Options ), they are not special. VARIABLE NAME DESCRIPTION FS input field separator variable OFS Output Field Separator RS Input Record Separator variable ORS Output Record Separator Variable NR Number of Records NF Number of Fields in a record FILENAME Name of the current input file FNR Number of Records relative to the current input file RLENGTH length of the substring matched by the match() function RSTART first position in the string matched by match() function FS - input field separator variable It represents the (input) field separator and its default value is space. Linux Linux Utilities Bash Development
Awk If Statement In this awk tutorial, let us review awk conditional if statements with practical examples. Normally conditional statement checks the condition, before performing any action. If the condition is true action(s) are performed. Similarly action can be performed if the condition is false. Conditional statement starts with the keyword called "if". Awk supports three different kind of if statement. Awk Simple If statement Awk If-Else statement Awk If-Else-If statement awk If Statement Single Action: Simple If statement is used to check the conditions, if the condition returns true, it performs its corresponding action(s). Linux Linux Utilities Bash Development
YUM Commands for Package Management What is YUM? YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool for RPM (RedHat Package Manager) based Linux systems. It allows users and system administrator to easily install, update, remove or search software packages on a systems. It was developed and released by Seth Vidal under GPL (General Public License) as an open source, means anyone can allowed to download and access the code to fix bugs and develop customized packages. Linux
Useful tips for Debian based distros Debian bookworm - behavior of more utility has changed I've just ran apt upgrade and apt dist-upgrade and noticed the behavior of more utility has changed. In particular I have to supply -e option in my scripts otherwise it currently presents me with (END) prompt in console. Or when I have alias with more utility, example: alias lf="ls -alFh|more", the output end with (END) prompt in console. Manual says the following: Debian Linux Linux Utilities
How to remove/delete CTRL-M (^M) characters from text files in Linux and UNIX systems Newline Newline (frequently called line ending, end of line (EOL), line feed, or line break) is a control character or sequence of control characters in a character encoding specification (e.g. ASCII table or EBCDIC ) that is used to signify the end of a line of text and the start of a new one. The concepts of line feed (LF) and carriage return (CR) are closely associated and can be considered either separately or together. Linux