Reproduced from: http://blog.csdn.net/askbai666888/article/details/9995837
(1) tree-a display all files and directories
(2) tree-d display directory name rather than content
(3) Tree-f displays the full relative path name before each file or
Cut-and
The Cut command extracts text columns from a text file or text stream.
Cut syntax
[root@www ~]# cut-d ' delimited character '-f fields
The PATH variable is as follows
[Root@www ~]# echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/
Echo is similar to the LS command. Many functions can be implemented through regular expressions.
For example, we can use echo. * To display all the files under the current folder, but by using echo-d. [!.]? * You can remove the current
#!/bin/bash
# This are a Shell script to find the files created by today
#
# Usage are:
#
# test.sh
#
function Recurce ()
{
CD is #进入该目录 for
file in *; #对目录中的每一个文件都逐一检查
do
if [d "$file"]; then
Find command: Search for files in specified directory
commonly used option:
-name: Specify the filename, or use "*.py" to specify the suffix name of the file, such as searching all the py files under the/home directory
Find/home-name ' *.py '
Definition and use of 1.shell variables my_dir= "/home/yk/desktop" # ( any character in single quotation marks is output as is, the variable in the single-quote string is not valid;)Echo $my _direcho ${#my_dir} #获取字符串长度2.shell annotations Single
January 11, 2017, Wednesday Shell parent-child processStart/execute mode:Current shell: #!/bin/bash must start at the beginning the first line of #! Will be discovered by the kernel, is a magic number , the kernel will
System variables, display all variables of the current shell set reference variable $ plus variable nameGlobal variable: Export variable nameAssign the return value of the command to the variable: a= ' ls-la ' inverted quote equals a=$
The shell is a command interpreter
Shell scripts are similar to batch programs under a DOS system (disk operating system)
The Shell scripting language is ideal for working with plain text types of data (configuration files, log files)
The
1. RequirementsServer Master Agent Envtype8.0.0.1 8.0.0.11 8.0.0.111 AAA8.0.0.1128.0.0.12 8.0.0.1138.0.0.1141. Get the list of machines in the document/etc/ansible/hosts[Server][Master][Agent]2. contract to target Machine2.1 Send flask to all
Beginners, do not consider the good-looking, high efficiency is not high! Need to meet the needs first! Demand is the first place!grep, SED, awk. Three Musketeers!Learn the shell, need the premise!1.linux System Command Proficiency2. Figure out the
Today I received a request that a string be included in the result of the script execution and asked to find out.The idea I gave was to write the text in an appended way according to the name of the script and the result, and then find the
Implementation scenario: 1. Add:& at the end of the command#/bin/Bashall_num=Tena=$(Date+%h%m%S) forNuminch`seq 1${all_num} ' Do { Sleep 1 Echo${num}}& Doneb=$(Date+%h%m%S)Echo-E"starttime:\t$a"Echo-E"endtime:\t$b"With the & symbol at the end
Today, we found that there are too many empty lines in a file and we intend to delete them.
So I used SED and checked the command to write it like this:
Sed '/^ $/d' file1
I found that there are still a lot of blank lines in the output content,
Why do we have to work overtime, not occasionally. If a large number of people work overtime due to our ability problems, we can only say that the HR department has recruited the wrong person. We should not come here to dismiss us. How many
1. Find the number of times "Linux" appears in the file sample.txt
#! /Bin/bash # How many "Linux" in linux.txt? Grep-o "Linux" linux.txt | WC-lgrep-c "Linux" linux.txt
2. Retrieve the first column (User Name) of/etc/passwd and use "the N
From: http://standalone.javaeye.com/blog/511101
1. Use the shell variable $ randomEcho $ random
2. Use Random Functions of awkAwk 'in in {srand (); print rand ()}'
3. Use the System Device File/dev/random and/dev/urandomDd If =/dev/random | OD-
This book has no answer. If you send an email to the author, he will not provide the answer. So I had to answer the question myself.
Chapter 5
5.1
Q Cai-English-1984-Jiangsu-7
Q Cai-English-1984-Jiangsu-7
Q Cai-English-1984-Jiangsu-7
Q Cai-English-19
You often need to switch to a common directory, but the path is long and hard to remember. You want to use a script to enter the directory, but it will never change .......
Cause analysis:
When the script is executed, only a sub-process is
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