Linux

Linux is a family of open-source Unix-like operating systems based on the Linux kernel. Some of the most popular Linux distributions include Debian, Fedora, and Ubuntu.

www.linux.org

Postgres DB backup script

To export a postgres database We use the pg_dump command: pg_dump -U postgres -v DATABASE -f FILENAME.sql And to import it back we use psql: psql -U postgres -W -d "FILENAME.sql" < FILENAME.sql Now that we know these commands We can easily create...

List all cronjobs for all cPanel users

To list all cronjobs for all users on a cPanel server use the following command for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done To list cronjobs for a single user, navigate to /var/spool and view the user file: cd...

How to block / quarantine extensions in Proxmox Mail Gateway

To block incoming emails in Proxmox Mail Gateway that contain attachments with a specific extension, for example, .cab I recommend blocking both the extension (MIME type) and the filename (files that end with .cab). To do this first log in to...

How to check and change runlevels in RHEL

A runlevel is one of the modes that a Unix-based OS will run on. Each runlevel has a certain number of services stopped or started, giving the user control over the behavior of the machine. The following runlevels are defined by default under Red...

What is a sticky Bit and how to set it in Linux

In this tutorial we will see about Sticky Bit, so what is a sticky Bit and how to set it in Linux? The sticky bit is set on directories to forbid all the users in the system to rename or delete the directory or the files/directories inside the...

Initial Server Setup with CentOS 7

When you first create a new server, there are a few configuration steps that you should take early on as part of the basic setup. This will increase the security and usability of your server and will give you a solid foundation for subsequent...

Shell Script to Check Linux System Health

This script collects system information and status like hostname, kernel version, uptime, cpu / memory / disk usage. Script uses hostname, uptime, who, mpstat, lscpu, ps, top, df, free, bc commands to get system information and cut, grep, awk and...

Gping – A Visual Ping

Ping is one of the most used functions. It is the function that allows to check in a more or less effective way if there is connectivity with a device or Internet access, and detect problems. In this article, we will talk about a tool named Gping...

Format a USB drive from the Command Line

Although we have applications to format USB drives like “gparted” in Linux, knowing the process in the command line is useful when working remotely or working on computers with few resources. The steps as well as the process is compatible with any...

Bash script to check broken links in a website or 404 messages

I needed to check a website , because some links doesn’t exist and when you open some web pages  you get a “404”. #!/bin/bash echo "Checking broken links on " $1 echo "Extract all links in the main page..." wget --spider -r -nd -nv -H -l 1 -w 2...