Posts

netstat command not found in CentOS 7 / RHEL 7

Netstat command is tool to check the network configure and activity. The default centos 7 and RHEL 7 not found netstat command. How to use netstat command on Centos 7 and RHEL 7 To find out which package provides "netstat" command. yum provides */netstat Or yum whatprovides */netstat The output screen as below net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools Repo        : @base Matched from: Filename    : /bin/netstat Install netstat command # yum install net-tools The output screen as below: Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile  * base: ftp.jaist.ac.jp  * epel: mirror.ehost.vn  * extras: ftp.jaist.ac.jp  * updates: ftp.jaist.ac.jp Resolving Dependencies --> Running transaction check ---> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================...

Linux commands cheat sheet

System Commands Command Description Examples shutdown bring your system down shutdown -h now --> Halt or poweroff after shutdown shutdown -r now --> Reboot after shutdown halt stop your system. halt reboot reboot your system. reboot uptime Tell how long the system has been running. uptime runlevel find the previous and current system runlevel. runlevel printenv print all or part of environment printenv env run a program in a modified environment env hostname show or set the system's your host name hostname --> show the system's host name hostname newhostname -->- set the system's uname print system information uname -a --> print all information locale Displays information about the current locale, or ...

zimbra notify password expired by bash script

Image
Introduction Zimbra Collaboration Suite (ZCS) is a popular open-source email platform that provides enterprise-level features for communication and collaboration. As an administrator, managing user accounts effectively is crucial, and one common challenge is handling expired passwords. Automating the notification process with a Bash script can save time, enhance user experience, and improve security. This article explores how to use a Bash script for notifying Zimbra users about password expiration In this tutorial, we’ll cover how to remind users about password expiration on Zimbra. The Bash script adheres to a policy of 120 days for password expiration and notifies users in advance. We will create a script named zimbra_notify_change_pass.sh to automate this process. Understanding Zimbra and Bash Scripts What is Zimbra? Zimbra is a powerful platform combining email, calendar, and collaboration tools into one suite. It’s known for its reliability and versatility, making it a go-to sol...

Recover Data from Crashed Disks with ddrescue command: A Comprehensive Guide

Introduction Learn how to recover data from crashed disks using the ddrescue command in Linux . This step-by-step guide will help you rescue valuable data, solve mounting errors, and ensure your filesystem's integrity on CentOS 7. Data loss can be a nightmare, especially when it involves critical files and documents. In the world of Linux, there are powerful tools designed to mitigate such risks. One such tool is `ddrescue`, a command-line utility that specializes in rescuing data from damaged disks. Whether you're dealing with I/O errors or corrupted filesystems, `ddrescue` offers a reliable solution to recover data from crashed disks. In this guide, we will explore how to use the `ddrescue` command to recover data from a failed disk on a CentOS 7 server. We will also address common mounting errors, such as the "wrong fs type, bad option, bad superblock" error, and provide solutions to resolve these issues. What is ddrescue and Why Use It? `ddrescue` is a GNU utility...

Zimbra Enable PTR/Reverse DNS lookup Incomming Email

Image
Introduction PTR/Reverse DNS lookup is an essential configuration for mail servers to authenticate and validate incoming emails, ensuring smooth communication and reducing spam risks. For Zimbra administrators, enabling this feature can enhance the server’s credibility and align with email best practices. This guide walks you through enabling PTR/Reverse DNS lookup for incoming emails in Zimbra, using examples and best practices to ensure a seamless setup. Why PTR/Reverse DNS Lookup is Crucial Understanding PTR/Reverse DNS Lookup PTR (Pointer Record) or Reverse DNS (rDNS) lookup is the process of mapping an IP address to a domain name, opposite to the conventional DNS resolution. This lookup is crucial for email servers to: Verify sender authenticity: Ensures that the sending server’s IP matches its domain. Prevent spam: Many spam filters rely on reverse DNS to block suspicious emails. Improve deliverability: Trusted email providers prefer servers with correctly configured PTR recor...

How to using NGINX Multiple ssl certificates on one ip

Image
I experienced setup and configure nginx multiple domain on one VPS. In this tutorial, How to using NGINX Multiple ssl certificates on one ip. Multiple SSL Certificates use letsencrypt Web server: Nginx Two domain: domain1.com domain2.cm IP VPS: 111.111.111.222 You buy VPS linux and configure multiple domain on one ip VPS server. I use VPS linode.com cheap 5 USD/month. I love it! Nginx Redirect all HTTP requests to HTTPS server {         listen 80;         listen [::]:80 ipv6only=on;         if ($host = www.domain1.com) {         return 301 https://$host$request_uri;         }         if ($host = www.domain2.com) {         return 301 https://$host$request_uri;         }  ...

Run bash script on boot time on centos

How to Auto Execute Commands/Scripts During Reboot or Startup on centos . Many method to execute a command or run scripts during startup. Method 1: Linux Execute Cron Job After System Reboot Use @reboot in cron scheduler. It will run once, at startup after reboot your system. Edit crontab # crontab -e To run a script called /home/huuphan/auto_excute.sh @reboot /home/huuphan/auto_excute.sh Method 2: Using /etc/rc.d/rc.local file This method is vaild for systemd-based distributions. To grant execute permission to /etc/rc.d/rc.local # chmod +x /etc/rc.d/rc.local And add your script at the bottom of the file /etc/rc.d/rc.local # echo "/home/huuphan/auto_excute.sh" >> /etc/rc.d/rc.local Conclusion In this article, how to Run bash script on boot time on centos. Use two method: Crontab and /etc/rc.d/rc.local file.

Linux create user Using `useradd`

Image
Introduction Learn how to create and configure a user in Linux using the `useradd` command. This comprehensive guide covers creating a user, assigning groups, and configuring sudo privileges without a password. Managing user accounts is a fundamental task for any Linux system administrator. Whether you are setting up a new server or adding users to an existing system, understanding how to create and configure users efficiently is crucial. In this tutorial, we will explore how to use the `useradd` command to create a new user in Linux, assign them to specific groups, and enable them to execute sudo commands without requiring a password. Why Use `useradd` for User Creation? The `useradd` command is a powerful tool that allows system administrators to create user accounts with specific options such as User ID (UID), Group ID (GID), home directory, shell, and more. Unlike graphical user interfaces, `useradd` provides a streamlined way to automate user creation through scripts, making it i...

Shell script parse xml in linux

Image
How to use shell script parse xml file . In this tutorial, I will use grep command, awk command and sed command Reading xml file extracting value in linux . For example xml person file as below <person>   <sex>Male</sex>   < firstname >Huu</ firstname >   <lastname>Phan</lastname>   <sex>female</sex>   < firstname >Miranda</ firstname >   <lastname>Kerr</lastname> </person> How to extracting value Huu and Miranda  of < firstname > < /firstname > Use grep command [huupv@huupv huuphan.com]$ grep -oP '(?<=<firstname>).*(?=</firstname)' person.xml Use awk command [huupv@huupv huuphan.com]$ awk -F "[><]" '/firstname/{print $3}' person.xml Use sed command [huupv@huupv huuphan.com]$ sed -n '/firstname/{s/.*<firstname>//;s/<\/firstname.*//;p;}' person.xml  The result, Shell script parse xml in linux

rename command in linux

Image
rename command similar with mv command. This command is slightly more advanced than mv  command. How to rename multiple files in linux. The syntax rename command rename [options] expression replacement-file For example, basic use rename command [huupv@huupv huuphan.com]$  rename file huu file1.txt The same output How to rename all file extension .txt to .atxt file [huupv@huupv huuphan.com]$ rename .txt .atxt *.txt The same output Use option --verbose in rename command [huupv@huupv huuphan.com]$ rename -v foo huu foo?.atxt The same ouput `foo2.atxt' -> `huu2.atxt' `foo3.atxt' -> `huu3.atxt' Details more information rename command man rename