Using the shell to combine awk is a good way to tell if a process is running or if a program file is being executed, as an example of PHP.
Define a crontab, execute every minute, the time interval is one minute, possibly next time executes, the
If you are an IT person accustomed to a Windows command prompt, you will feel overwhelmed when you first use the Linux command line. You are familiar with DOS commands that are basically non-existent in Linux. In front of you is a lot of orders to
This example mainly realizes the function that VB calls the external EXE program to run, this is mainly uses the Shell function to execute, the shell function is mainly used to open an external exe executable file, for example, in sub module: Shell "
Objective
We all know that when you use the LS command to list file lists, different file types are displayed in different colors. So how do you implement this color-colored text output? The answer is not complicated, whether it's in the shell or
The shell may often see: >/dev/null 2>&1
The result of the command can be defined as the output in the form of%>
/dev/null represents empty device files
> represents where to redirect, for example: echo "123" >/home/123.txt
1 indicates stdout
A few days ago, there were some interesting examples of redirects and piping-related usage. Software communication based on TCP/UDP protocol is implemented through redirection.
There is a special file in the Linux device:
/dev/[tcp|upd]/host/port
MyCommand >mylog.txt 2>&1 should be the most classic usage.
The result of the command can be directed output in the form of "%>",% representing the file descriptor: 1 is standard output stdout, 2 is standard error stderr. The system default% value
This article introduces the Linxu shell of the relevant knowledge of the array, and a lot of examples for reference, including the copy of the array, calculation, deletion, replacement, etc., is to learn the shell array of rare good articles.
The
Sometimes you write scripts with errors that are listed like headings, mostly because your script files are edited under Windows. Windows, the end of each line is \n\r, and in Linux under the end of the file is \ n, then you edit the file in Windows
Since SSH can execute remote command, the FTP software is also gradually less used.
Every time the server code is updated, all want to pack, upload, login to the server to modify file permissions, update Cache, and so on, slow and error prone, so
As a Linux SA, many parts of the day-to-day operation of the script, and the server's IP is generally static IP or Mac binding, of course, the latter comparison is relatively cumbersome, and the former we can set the host name, IP information,
How to identify the number of physical CPUs, a few cores, is hyper-threading or multi-core
Judge the basis:
1. CPUs with the same core ID are the same core hyper-threading.2. CPUs with the same physical ID are the same CPU-encapsulated threads
In the process of sorting out the word library encountered a problem, some are actually the same keyword with a space, can not be normal to be heavy, then there is no way to quickly remove these characters in the middle of the space? After Baidu
It's fun for the terminal print in the shell!First know that the end of the shell print has echo printf is commonly used is echo slightly;
Note: Font Color reset = 0, black = 30, red = 31, green = 32, ***=33, blue = 34, magenta =35, cyan = 36,
Case statements are used to implement multiple if. else, but the usage is somewhat different, people who have learned other languages know that the case to match the variables, if there is a matching successful words to execute the corresponding
This section mainly discusses the mathematical related shell script programming.
Addition operations
Create a new file "addition.sh", enter the following and give it executable permissions.
Copy Code code as follows:
#!/bin/bash
In order to prevent the server from being subjected to SSH brute force hack, will attempt ssh brute force hack this machine more than 10 times of IP to seal off, prohibit its landing this machine!#!/bin/bashCat/var/log/secure |awk '/failed/{print $ (
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