Posts

Showing posts with the label Linux Commands

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...