Note
This article compiles from the Commandlinefu.com series article top Ten one-liners from Commandlinefu explained. As a Web site recommended by the user as the most useful shell command, it records tens of thousands of shell commands, some of
Http://www.cnblogs.com/chengmo/archive/2010/10/23/1858879.html
In daily life, random numbers are actually often encountered, want to throw dice, lottery, and draw lots. Oh, very simple can be achieved. So in doing programming, really to design a
Http://www.ha97.com/4021.html
1. Delete 0-byte filesFind-type f-size 0-exec rm-rf {};
2. View processArrange by memory from large to smallPS-E-O "%c:%p:%z:%a" |sort-k5-nr
3. By CPU utilization from large to small arrangementPS-E-O "%c:%p:%z:%a"
how Shell arrays operate
number of array elements ${#array [@]}
all elements of an array ${array[*]}
string length ${#str}
1, get the number of elements of the array:
array= (Bill Chen Bai Hu);
num=${#array [@]}///Get the number of array
The company does not have fixed IP, need to test the third party asynchronous callback interface (third party server How to find the company intranet machine); Baidu Search for "intranet penetration" results are mostly peanut shells, but this
The problem is:4) Known: The content of/etc/hosts is
192.168.1.11 oldboy11.etiantian.org
192.168.1.21 oldboy21.etiantian.org
192.168.1.31 oldboy31.etiantian.org
#192.168.1.111 oldboy111.etiantian.org
Please use the shell script to realize, how can
-S file file is somefile 0 o'clock
[f]: Determines whether it is a file [-
X "/bin/ls"]: Determines whether/BIN/LS exists and has executable permissions
[-n "$var]": Judge $va R variable has a value
["$a" = "$b"]: To determine if $a and $b
The difference between Su and Su-
The former only switches identities, but the shell environment is still the original user's shell, while the user and the shell environment switch to the new user. The PATH environment variable error will not
Today, the script on the company server to get its own notebook on the run error, set-x tracking discovery is a variable in the self-increase operation error occurred, the error section of the script is probably like this:
#! /bin/sh
param=0
Http://www.cnblogs.com/davidwang456/p/3784102.html
http://blog.csdn.net/yucan1001/article/details/8455757
http://blog.163.com/yangfan876@126/blog/static/806124562013720104712282/
1, dirs1) functionDisplays all records in the current directory
There are two ways to let echo output a color
1. Define the color variable in the shell script and use ECHO-E to invoke the variable
2. When defining variables, define the ECHO-E into a variable, and then output the variable
Shell script that allows
use of string comparison X "$variable" in Shell
This article refers to StackOverflow why does shell script comparisons often use X$var = Xyes? do not use double quotes "", do not use prefix x do not use double quotes "", use prefix x use double
The set command sets the parameter variables for the shell. The output of many commands is a space-delimited value, and using set is very effective if you want to use one of these data fields.
#!/bin/shecho the date is $ (date)Set $ (date)echo the
A program that often needs help explaining.
The ways to activate help instructions are described in two ways
1. The simplest way is to discriminate by the number of parameters. For example, displays the help description without any parameters.
2.
Http://www.cnblogs.com/wangkangluo1/archive/2011/09/23/2185938.html
Name: PSUsage rights: All usersHow to use: PS [options] [--help]Description: Shows the dynamics of the instantaneous stroke (process)Parameters: The parameters of PS are very many,
Transferred from: http://www.cnblogs.com/penghong2014/p/6065838.html
1. First download historian.py script, download address: Https://github.com/google/battery-historian2. Unzip the download and go to the
Some time ago in the study shell script, the last mention of the SED mode space and maintain the concept of space, but has not studied well, these two days studied, so it sent, not very comprehensive, just for your reference.
Keep the space sed
This article demonstrates how to use a shell script to complete adding a user, first making a decision if the user exists, prompting the user to already exist, or adding a new user.The sample code is as follows:1#!/bin/Bash2 3 Grep_user ()4 {5R=
Definition of 1.1shell1. Stacking of Commands2. A file consisting of specific syntax and specific commandsExecute script commandbash test.sh 不需要添加执行权限,使用解释器直接解释sh tesh.sh./tesh.sh 相对路径,需要添加执行权限1.2shell Script Base---VariablesVariable: A
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