On Linux, we can easily use the SCP command to copy files remotely, but because the SCP command itself has no save password option, so in the shell can not be like samba that way to save the password, more trouble, the following two implementation
Shell Learning Notes1, View/etc/shells, see how many shells are available.2, a command that has been used exists. Bash_history, but ~/The . Bash_history records All instructions recorded before the previous login and is successfully logged out
String-related operations are often involved in writing shell programs. There are many command statements, such as awk,sed , that are capable of doing string operations. In fact, the shell built a series of symbols to achieve similar effects, using
Problem: String output of ' 1,2,3,4,5 ' is used, separated by 1 2 3 4 5Feature: There are no spaces in the stringWorkaround 1:[Plain]View Plaincopy
#!/bin/bash
Var= ' 1,2,3,4,5 '
var=${var//,/} #这里是将var中的, replace with a space
Hardware Chapter
CPU-related
Lscpu #查看的是cpu的统计信息. Cat/proc/cpuinfo #查看CPU信息详细信息, such as the model of each CPU, frequency, etc.
Memory-related
Free-m #概要查看内存情况 The unit here is
Execute command : XargsWhen find produces a list of files , It is sometimes useful to provide the list to another command .Case :$touch abc.c ERD.C oiy.c$ll./erd.c./abc.c./oiy.c$find-name ' *.c ' | RmRM: missing operandPlease try "rm--help" for more
1.shell scripts are a collection of commands. Record a set of commands that need to be executed to the document, and then call the document.139 e-mail, receive the message at the same time by SMS notification.Shell Footsteps Writing recommendations:
Http://note.youdao.com/share/?id=a9d02257b639c94323c818bc38423919&type=notealias Command Alias:http://note.youdao.com/share/?id=cbcbd1156ab1f0835c4f76131dbf98e2&type=noteView Current User history commands History:http://note.youdao.com/share/?id=e878
-mtime 0 represents files that are currently 0 days away from the file modification time, which is less than 1 days (24 hours) away from the current time.-mtime 1 is a file that is currently 1 days away from the file modification time, which is 1
Local variables in shell scripts define functions in the shell to make the code modular and easy to reuse code. But the scope of the variables and functions of the script itself can be confusing, and here's a look at the problem. (1)The variables
Standard input and output with standard error outputStandard input/The output is probably the most basic concept in the design principles of software tools..His idea was to:The program should have a data source,Data Export(where are the data going?),
Structure of this article: Bash shell Introduction--variables and variable operations, array-->bash Environment profile analysis
What is a shell:
Operating system is a set of software to control the entire hardware and management
#common. SH, which is mainly some function # perform compiled cleanup work function make_clean { # $RE _ins based on the value of the variable, To determine whether to perform cleanup work if [ $RE _ins == 1 ]; then make clean >/dev/
CentOS under the shell display-bash-4.1$ does not display the user name path resolutionProblem Description:A new user is added under CentOS, and the shell script information is as follows when logged in:650) this.width=650; "src=" Http://up.2cto.com/
The variables of 0.shell are different from the environment variables, and the user environment area exists. Variables are assigned in the following way: Variable_name = variable_valuea= "Hello" $a the value of a on the variable, and several Linux
Shell Script (ii)#find查找文件 to find based on time, name, UID, GID, permissions, size, etc.A file or directory accessed within #-amin-10:10 minutes; a file or directory accessed +10:10 minutes ago. The time unit is minutes.#查找10分钟之前30分钟之内访问过的文件或目录Find/
Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:${file#*/}: Delete the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Remove the last/and left string: my.file.txt$
No matter what programming language is inseparable from conditional judgment. The shell is no exception.The approximate format is as follows:If List ThenDo something hereElif List ThenDo another thing hereElseDo something else hereFiAn
After the password expires, change the password to the original password, the server a lot of work, write scripts to complete.After logging in, modify the prompt to: doraemon# convenient expect matchModify Lang=c, prompt for English to prevent
Learning cycle, see a lot of for,while, or until, and select with less, here is a little summary of the next select this cycle.Basic structure:Select VALUE in LISTDoCOMMANDDoneAnd the reality out of the structure is probably a number before the
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.