List The 10 shells you use mostHistory | awk ' {a[$2]++}end{for (i in a) {print a[i] "i}} ' | Sort-rn | HeadHistory | awk ' {a[$4]++}end{for (i in a) {print a[$i] " " i}} ' | sort-rn | headgrep-v "#". Bash_history |awk ' {++a[$1]}end{for
List the number of connections per IPawk ' /^tcp/{print} ' awk ' !/^::/{print $ {} ' Sort Uniq Sort awk ' begin{printf "%-10s%s\n", "Connum", "IP"}{printf "%-10s%s\n", $1,$2} 'Command explanation:
Netstat-n refused to display aliases, can
-------------------------------------------------------------------------------------Regular expressions and wildcard characters:1. The regular expression is used to match the qualifying string in the file , and the Regex contains the match . grep,
character
meaning
*
Match 0 or more characters
?
Match any one character
[list]
Match any single character in the list
[!list]
Matches a character other
1. Describe the operation principle of shell program (can be attached with necessary graphic instructions);
Span style= " font-size:12px;">shell is a special program that is officially defined as the interface to the kernel and is
A shell script was recently invoked with Crontab, and a Python script was invoked inside the shell scriptIn fact, it is to abandon Python to write a judgment trouble, using the shell to write a if to judge the case to run this Python script.But
In order to match the previous text, here first to organize a key how to deploy LNMP environment;In fact, small and medium-sized enterprises in the production environment is also very like to use such software packages, because after all, the source
for((i =0; I 5; i++)) Do Echo "Current number is $i" DoneSERVICES="8000-3306" forXinch$SERVICES Do Echo$x Done forXincha b c Do Echo$x Done forIinch$* #$* is a string:"parameter 1 parameter 2 ..."form to save all parameters Do
First shell #!/Bin/bash echo "Hello world!" The "#!" fixed tag is used to specify which interpreter the script uses to parse the script and must have Execute permissions chmod+X./test.sh increased execution permissions./Test.sh executes the script
/*-------------------------------------------------------------------------------------------@ Black eyed poet --------------------------------------------------------------------------------------------*/A variable is a unit of computer memory
Reprinted from: Linux Shell arithmetic operationsThere are four ways in which the Bash Shell's arithmetic operations are:1: Using expr external programAddition R= ' Expr 4 + 5 'Echo $rAttention! ' 4 ' + ' 5 ' There should be a gap between the threeR=
${STR-NEWSTR} is only replaced when STR is NULL${STR:-NEWSTR} replace when STR is null or if STR is an empty stringAll in all,-number, when STR has no content, then replace,: The number just increases the case of an empty string. Note that the
Some of the details of the shell are not very familiar with, borrowed a lot of other people's Things1. Word Frequency This problem is simple, as long as can be sorted can be cat words.txt |tr-s "" \ n "sort | unique-c | Sort-r | awk ' {print $ ' $ '
The Helloword of the shellCd/binLs-l | Find-name SHLs-l | FIND-NAMD BashLs-l | Grep-r sh sh is actually pointing to dashlrwxrwxrwx 1 root root 4 2014-12-11 03:13 sh, dashLs-l | Grep-r BashCD ~mkdir ShellVI hello.sh#!/bin/bash//fixed notation,
When using the shell to pass parameters.Do not use shift when parsing parametersAction= "$" case "$action" in status) shift [email protected] exit $? ;; .. *) help exit-1;; EsacBecause even if there are double quotes, it cannot be passed
--run. SH Job commandSh. sh--let Job run behind stageNohup ./.sh&--met error as below when rub. SH jobError ' XX.sh:line XX:sqlplus:command not found 'Method:source. Bash_profile--delete file,-f (delete directly without remaind)rm-f filename--delete
Multi-thread Linux Shell script and linuxshell
In bash, we run (&) in the background to implement multithreading.
for((i=1;i
We have added {} & so that the execution in {} can be performed in the background. The above is equivalent to executing
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