A shell script sharing _linux shell that monitors the changes in Linux directories and files

Recently saw a group of people chatting to their server has recently been Hung horse, and then want to use a script to monitor the Web directory changes in real-time files, that is, the directory of additions and deletions to the corresponding log

Using the shell to determine the local area network users have those

#!/bin/bashwhile true; do  for i in {100..120};d o     ping -c 2 -w 2 192.168.0. $I  &>/dev/null    if [  $? -eq 0 ];then      echo -e  "\033[32;40m  192.168.0. $I  is up.\033[0m "    else      echo  -e  "\033[32;40m 192.168.0. $I  is down.\033[0m"  

Shell Special variables

Positional variables $ $ Gets the file name of the currently executing shell script, including the script path if the script is executed with a path[[Email protected] shell]# sh n.sh n.sh[[email protected] ~]# sh/shell/n.sh/shell/n.sh[[email

Shell Script Collation

Create the user who wrote the file650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/98/E0/wKiom1lBR5_gYB4HAAAoKuZARYU671.png "title=" Screenshot from 2017-06-13 19-44-27.png "alt=" Wkiom1lbr5_gyb4haaaokuzaryu671.png "/>Second, ping 172.25.2

Shell Script Usage Tips 2

0--stdin Standard input1--stdout Standard Output2--stderr standard Errorredirectecho "This was a good idea" > Temp.txtTemp.txt content will be emptied first before entering "this is a good idea"Additionalecho "This was a bad idea" >> temp.txtCat

Shell pre-defined functions for Linux

$ $1-n The name of the current shell script the position variable $ #参数的数量 $* the value of all positional variables #? To determine whether the previous command succeeded, 0 for success, The non-0 is the failure---------------------------------------

Shell Application Tips

Shell Application TipsThe shell is a command interpreter, a layer of interaction between the kernel and the kernel. There are many kinds of shells, the one with the prompt that belongs to /bin/bash, and almost all Linux Systems default to this shell.

Shell Programming 2

Shell Programming 2First, conditional judgment statement1, according to the file type to judge  Eg:test-e/etc/passwd or [-e/etc/passwd] &&echo yes | | echo no note [] There must be spaces on both sides2, according to the file permissions to

Linux Learning –shell Scripts

The shell is a bridge between command and hardware.The shell works in two ways: interactive, batch dispositionInteractive: A user enters a command at a time, the shell translates and executes aBatch processing: The user makes multiple commands into

The operating environment of the Bash shell

Path and command search orderBash Pit WelcomeBash Environment configuration fileTerminal settingswildcard characters and special symbolsThe TTY1~TTY6 command interface reads some key settings for the local computerUse Stty to view key contents[Email

The advanced application of the shell script awk

Demand:Text in the first column of the word typeface, and so on, the second column is added, the final output characters and the final and (for the convenience of final check, gave 1)The text is as follows:Cat test.logabc 1aaa 1bbb 1ddd 1sss 1iii

Seq in the shell magical

Add 20 users to the CLASS01 group in bulk, the user name begins with STD, ends with a number, format: STD01---STD20Method 1#!/bin/shgroupadd class01a=stdfor ((i=1;iMethod 2:#!/bin/bashgroupadd class01for i in {1..20}doif [$i-lt];thenuseradd "std0$i"-

Special characters of the shell

Bash is a powerful scripting language, which is the default shell in many Linux occurrences, supports variables and special characters, and looks at what special characters it has:; Command delimiter, you can write multiple commands in one line;;

Shell script temporary file generation and use, signal capture

Instance: Generate temporary file record Apache process number, kill Apache process, Delete temp file 1#!/bin/Bash2#create_log. Sh3 4#1. Get the process number to all httpd applications5#2. Deposit the process number in a temporary

Shell processing input

1, when the script is run to specify parameters, directly behind the script name to follow the parameters to be added, in the process of running, "$" represents the program name, "$" represents the first parameter, the second parameter, the Nineth,

debugging shell scripts in Linux

The original script check.sh:Monfile= "/var/log/test/testmon.txt"Logfile= "/var/log/test/testmon.log"Touch $monfile...The script is edited in window and uploaded to Linux after editing.Problem:After running, the file that appears in the directory is

Shell script implementation randomly sampled class students

Tag:style   date    Implementation    bin   nbsp    and    extracting    cti   bsp    #/bin/bashfunction rand () {min=$1Max=$ ($2-$min +1 ) num=$ (date +%s%N)Echo $ (($num% $max +$min))}rnd1 the ) JW=(Wang Hao Shein Huang Yang Hoxing Yu Hu Jiang

Monitoring NTP shell scripts

[Email protected]/]# cat/home/monitorntp.sh#!/bin/bash# Process NameProc_name= ' Ntpd-u '# log fileFile_name= "/home/logs/ntpd.log"Pid=0# Number of calculation processesProc_num (){Num= ' Ps-ef | grep "$proc _name" | Grep-v grep | Wc-l 'return $num}#

Shell sequencing of data structures

#SIZE 10Direct Insert Sortvoid Insert_sort () {int i,j;int array[size+1];ARRAY[]={0,12,23,11,55,2,34,18,20,48,22};for (i=2;iArray[0]=array[i];J=i-1;while (Array[0]ARRAY[J+1]=ARRAY[J];j--;}ARRAY[J+1]=ARRAY[0];}}Binary Insert Sortvoid

KVM One-click Shell automatically generates a Windows virtual machine with unattended operation scenario (STEP1)

KVM One-click Shell automatically generates a Windows virtual machine, unattended operation scheme is divided into four steps to complete the joint;The first step: Start the startup script, so that the machine can be executed at the start of the

Total Pages: 541 1 .... 536 537 538 539 540 541 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.