Due to work needs, often to connect the mobile phone and use the ADB to do some operations, found that the shell function is very good, but in castration state, the most obvious one is, the implementation of a number of commands, the directory
When you are using some commands, such as: LS, git, just met some requirements is to easily traverse all the directories and files, and then after the search, finally found a "magic" wildcard "* *" (two asterisks), after setting the bash globstar
$: Gets the file name of the currently executing script, including the path.
[Root@test script]# Cat 0.sh#!/bin/bashecho $[Root@test script]# SH 0.sh0.sh[Root@test script]# Cat 0.sh#!/bin/bashDirName "$"BaseName "$"[Root@test script]#
A few days ago found that the site is not open, prompted the database connection error, I log on to Linux found Mysqld services do not know when to stop. Luckily, I even found out.So I decided to write a shell script to automatically detect the
Previously only heard DreamHost support shell, but not specifically used, mainly in the past is not very need, has not uploaded too many things.
Recently because to upload a large number of files, suffering from the speed of optical cable can not
Introduced
The grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching rows. The grep full name is global Regular Expression Print, which represents the global regular
In general, use the "Telnet IP port" to determine the port pass, in fact, testing methods more than this one, there are many ways, the following small series to share several methods, the specific content please look down:
Preparing the Environment
Quote: I have never written a shell script before, perhaps because of laziness, perhaps not being forced to write a shell. However, some time ago, the job requirement required a rerun of the script for a few months, which ran regularly every day,
The shell is actually a command interpreter that interprets the commands entered by the user and sends them to the kernel. Not only that, the shell has its own programming language for editing commands, which allows the user to write a program
The color of the text terminal can be generated using the ANSI non-normal character sequence. Example:
Echo-e "\033[44;37;5m ME \033[0m Cool"
The above command sets the background to blue, the foreground is white, the blinking cursor, the output
#查找当前目录中是否存在指定目录, if it does not exist, it is created
Copy Code code as follows:
function mkdir_1
{
if test! -D $
Then
mkdir $
Fi
}
#指定文件中的 "prefix =. *" string replaced with "prefix=/home/gnome-unicore-install2/usr/
This article to introduce you to the very detailed, specific details please see below.
Start the installation modify the/etc/inittab file first:
Id:5:initdefault:
To
Id:3:initdefault:
#vi/etc/inittab
and restart the computer.
The system
1. Automatic Ssh/scp method
A is a local host (that is, a machine used to control other hosts);b is a remote host (that is, a controlled machine server), if IP is 192.168.60.110;Both A and B systems are Linux.
To run a command on a:# ssh-keygen-t
This shell script is primarily used for initialization of newly installed Linux server systems, including:
Turn off the IPV6 module
Close SELinux
Let vim display color
Set System language encoding
Optimizing System Services
Kernel parameter
Script content:
Copy Code code as follows:
#!/bin/bash
For IP in ' cat ip.lst '
Todo
./ssh.exp $ip >/dev/null 2&>1
Done
nk= ' awk ' begin{bs=4000000}/access/{if ($1>bs) {Nk=nr-1;print nk}} ' Exp.log '
For NNK in $NK
Todo
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
The script that prints the Java thread occupancy stack is invoked if the CPU occupancy rate continues to reach more than 80, see https://github.com/oldratlee/useful-shells/blob/master/ Show-busy-java-threads.sh, see his GitHub wiki! in concrete
Shell BasicsFirst, Shell Overview1) The Shell is a command-line interpreter that provides the user with an interface system-level program that sends a request to the Linux kernel to run the program, allowing the user to start, suspend, stop, or even
Nginx does not support using cronolog to rotate logs like Apache, but you can use the following methods to cut log files:Mv/data1/logs/access. log/data1/logs/20111030.logKill-USR1 Nginx master process numberUse the mv command to rename the log file
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