Category Archives: Linux

You got to love Linux. Not only that it is free, but it is also very strong, stable, and widely used.

Block Countries by IP on Debian Trixie with nftables and xtables-addons

Debian Trixie uses nftables as its default firewall. If you’re used to iptables, the commands still work — but they go through an iptables-nft compatibility shim that translates them to nftables rules under the hood. For country-based IP blocking, the … Continue reading

Posted in Linux | Tagged , , , | Comments Off on Block Countries by IP on Debian Trixie with nftables and xtables-addons

List open or listening ports

You started a service, you can’t tell whether it actually bound to its port, and you want to see what’s listening — or you want to find out which process is squatting on port 8080. Two one-liners, two operating systems: … Continue reading

Posted in Bash, Operating System | Comments Off on List open or listening ports

CentOS 6 repo Settings

To fix repo settings in CentOS 6 1. make sure there is no proxy or funny settings in vi /etc/yum.conf 2. There are a couple of files within /etc/yum.repos.d/. Make sure the url are correct (accessible) and enabled=1 ll /etc/yum.repos.d/ … Continue reading

Posted in Linux | Comments Off on CentOS 6 repo Settings

Show Linux Partition Tree Mountpoint and If SSD

1lsblk -o TYPE,NAME,KNAME,UUID,MOUNTPOINT,SIZE,ROTA

Posted in Linux | Comments Off on Show Linux Partition Tree Mountpoint and If SSD

SELinux directory permission

To check SELinux directory permission you need to -z for example 1ls -Z /var/www/html If something is incorrect you can re-adjust some of the directory permission: 1chcon -R -t httpd_sys_content_t /var/www/html

Posted in Linux, Operating System | Comments Off on SELinux directory permission

RedHat / Centos Firewall

To add an exception to firewall In RedHat/CentOS 6 12345iptables –line -vnL iptables -A INPUT -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp -s 192.168.0.0/16 -j ACCEPT iptables -D INPUT -p tcp -s … Continue reading

Posted in Linux, Operating System | Comments Off on RedHat / Centos Firewall

Bash string comparison

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#!/bin/bash function test(){ echo "" echo "TEST $1" echo "VAR_1: $VAR_1 VAR_2: $VAR_2 " if [ "$VAR_1" = "false" ]; then echo " VAR_1 is false"; fi if [ "$VAR_2" = "false" ]; then echo " VAR_2 is false"; fi … Continue reading

Posted in Bash, Linux | Comments Off on Bash string comparison

VirtualBox – Imporving usability on guest OS

GUEST OS: Centos 6.7 final HOST OS: Windows 7 Virtualbox version: 5.0.4 1yum install gcc kernel-devel kernel-headers dkms make bzip2 perl

Posted in Linux, Operating System | Comments Off on VirtualBox – Imporving usability on guest OS

RedHat or CentOS 6 iptables adding an open port

iptables –line -vnL iptables -I INPUT 5 -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT service iptables save

Posted in Linux | Comments Off on RedHat or CentOS 6 iptables adding an open port

Crontab header

123456# minute (0-59), # |      hour (0-23), # |      |       day of the month (1-31), # |      |       |       month of the year (1-12), # … Continue reading

Posted in Bash, Linux | Comments Off on Crontab header