Posts

Showing posts with the label Linux Commands

How to reset root password on centos 7

Image
Many methods to reset root password centos 7. if GRUB 2 bootloader then no longer using in single-user mode as well as emergency mode. To below step by step to reset root password centos 7. You may reading link below : awk useful commands examples CentOS/RHEL Use yum Command To Downgrade Upgrade or Rollback Updates Generate and Verify Files with MD5 Checksum in Linux use inotify-tools on centos Step 1: Start the system, on Grub 2 boot screen, you press the e key as shown below. Step 2: In linux16 line or linuxefi on UEFI system, add parameters end line as shown below. rw init=/bin/bash Using Ctrl+A press or Ctrl+E press to start or end a line. Disable paramenters the rhgb and quiet in order to enable system message as shown top. Step 3: you press Ctrl+x to start single user mode passwd Step 4: update selinux information touch /.autorelabel Step 5: To resume the initialization and finish the system boot. exec /sbin/init Video how to reset root password on cen...

A Comprehensive Guide to use inotify-tools on centos

inotifywait - wait for changes to files using inotify. When it comes to real-time monitoring of file system events, inotify-tools is an indispensable tool. Especially for CentOS users, mastering inotify-tools can significantly enhance the efficiency of system administration tasks. This guide will walk you through everything you need to know about using inotify-tools on CentOS, from installation to advanced configurations, ensuring that you can leverage its full potential. Introduction to inotify-tools Inotify-tools is a command-line utility that leverages the inotify (inode notify) feature of the Linux kernel, allowing you to monitor file system events. This is incredibly useful for tasks that require real-time responses to file changes, such as automatic backups, log monitoring, and dynamic content updates. Why Use inotify-tools on CentOS? CentOS is widely used in enterprise environments due to its stability and robust performance. By integrating inotify-tools, you can automate and...

Mastering the screen command on Linux: Installation, Usage, and Troubleshooting

Introduction Learn how to install and effectively use the screen command on CentOS/RHEL and Ubuntu-based systems. This guide covers installation, session management, common issues, and FAQs to enhance your Linux terminal experience. In the world of Linux, the terminal is the heart of operations. Whether you're managing servers, running long processes, or multitasking across various projects, keeping your terminal sessions active and organized is essential.  This is where the screen command comes in—a powerful utility that allows you to run multiple terminal sessions from a single console. This article will guide you through the installation, usage, and troubleshooting of the screen command on Linux systems, ensuring you can manage your terminal sessions like a pro. How to Install the screen Command Before diving into the functionalities of the screen command, it’s important to ensure it’s installed on your system. The installation process varies depending on your Linux distribu...

Linux basic commands for Every User

Introduction Learn the essential Linux basic commands that every user and administrator should know. From checking your Ubuntu version to managing users, this comprehensive guide provides step-by-step instructions for each command. Linux is a versatile and powerful operating system, popular among both tech enthusiasts and professionals. Whether you are a beginner or an experienced user, mastering the basic commands is crucial for managing and operating a Linux system efficiently. This guide will walk you through the essential Linux commands, helping you understand how to check system information, manage users, and more. By the end of this guide, you'll be equipped with the foundational skills needed to navigate and control your Linux environment with confidence. How to Check Your Ubuntu Version One of the first tasks when working with a Linux system is to know which version of Ubuntu you are running. This information is vital when installing software, troubleshooting issues, or co...

How to send email using mail command in linux

Image
in my post, i'm use mail command to send message email. mail -s "Subject title huuphan.com" -S from=huupv@huuphan.com <<EOF ---------------------------------------- The content email Hello phan van huu My site: huuphan.com ----------------------------------------- EOF The script sending 100 email from command. #!/bin/sh i=1 for (( i = 1 ; i <= 100 ; i++ )); do  echo "Test Mail $i, Send from mail.huuphan.com" | mailx -v -r "huupv@mail.huuphan.com" -s "Test Mail $i" -a "/tmp/quotausage" -S smtp="mail.huuphan.com:25" -S smtp-auth=login -S smtp-auth-user="huupv@mail.huuphan.com" -S smtp-auth-password="123456789" -S ssl-verify=ignore -S nss-config-dir=/etc/ssl/certs another@mail.huuphan.com,pvhuu285@gmail.com done

Mastering xdotool − command−line X11 automation tool

Introduction Discover how to automate tasks on Linux using xdotool , the powerful command-line tool for X11 automation. Learn how to install xdotool , create scripts, and explore practical use cases. Optimize your Linux workflow with expert insights in this comprehensive guide. In the Linux ecosystem, the ability to automate repetitive tasks can significantly enhance productivity and efficiency. One of the most versatile tools available for automating tasks within the X11 graphical environment is xdotool . Whether you're looking to simulate mouse and keyboard actions, move windows, or execute complex workflows, xdotool provides the flexibility you need to streamline your operations. This guide will walk you through the process of installing xdotool on popular Linux distributions, demonstrate how to create simple yet powerful scripts, and explore real-world applications of this tool. By the end of this article, you'll have a solid understanding of how to use xdotool to impro...

How to running cron job every 5 minutes,seconds,hours,days

Image
How to running cron job every 5 minutes,seconds,hours,days. How to running a script a specific interval using cronjob in linux.  To execute a cronjob every 5 minutes */5 * * * * /home/huupv/script.sh To execute a cronjob every 5 hours 0 */5 * * * /home/huupv/script.sh How to running a job every 5 seconds $ cat every-5-seconds.sh #!/bin/bash while true do  /home/huupv/script.sh  sleep 5 done $ nohup ./every-5-seconds.sh & To execute a cronjob every 5th weekday 0 0 * * 5 /home/huupv/script.sh or 0 0 * * Fri /home/huupv/script.sh 0=Sun 1=Mon 2=Tue 3=Wed 4=Thu 5=Fri 6=Sat

Bash Scripting Made Simple: Practical Examples

Bash Scripting Made Simple: Explore practical examples to streamline your workflow and enhance your bash scripting skills effortlessly. List all IP addresses connected to Server Discovering all IP addresses connected to the server is essential for network monitoring and security. Utilize tools like netstat or ss commands to obtain this information efficiently. #!/bin/bash while true; do echo "CTRL+C TO BREAK" netstat -tnu | grep :22 | awk '{print $5}' | cut -f1 -d : | sort | uniq -c | sort -nr | head -n 8 sleep 15 clear done ########################################################################################### # site: huuphan.com # author: phan van huu # List all IP addresses connected to Server # For example: list ip address connected to server via ssh port 22 # awk '{print $5}' | cut -f1 -d : | sort | uniq -c | sort -nr | head -n 8 # awk '{print $5}': the display 5th field only # sort | uniq -c | sort -nr: Sort the list, group it...

The usefull linux commands

Introduction Master essential Linux command-line operations with this comprehensive guide. Learn practical tips for managing log files, executing commands efficiently, and optimizing your system administration skills.   Welcome to our guide on mastering essential command-line operations and system management tasks! Whether you're a beginner or an experienced user, these techniques will help you navigate the command line with ease. In this blog post, we'll explore practical tips and tricks to streamline your workflow and boost productivity. Join us as we dive into managing log files, executing commands efficiently, and optimizing your system administration skills for success. How to Find and Delete Log Files Older Than 30 Days One of the key tasks in system administration is managing log files. Over time, these files can accumulate and consume significant disk space. Here's how you can find and delete log files that are older than 30 days:  # find /path/to/log/ -type f -name...

iptables examples: Comprehensive Guide

Introduction iptables is a powerful tool for protecting Linux systems from unauthorized access and cyber threats.  In this article, we guide you through configuring and using iptables to manage firewall rules, from basic to advanced levels, ensuring maximum security for your server. Whether you're a beginner or an experienced system administrator, this post provides practical, detailed examples on how to use iptables to control IP access, manage ports, and set up effective connection limits for enhanced server protection.  You may reading link as below: Iptables how to How to reset password on centos 7 Bash script example 1. Basic iptables Rules Below is a sample iptables configuration to manage incoming and outgoing connections effectively: *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --d...