Uptime command:-* Use the uptime command to get host run time and query Linux system load information. The information is displayed in the following order: Now time, the system has elapsed time, the current number of landing users, the system in the
One, hand-bound network card
Dual network card binding implementation is to use two network card virtual to become a network card, the aggregation of equipment appears to be a separate Ethernet interface equipment, popular point is that two network
Recently, when customizing ISO, there is a need for specific projects to run with a specific user, to remove root permissions. This requires creating a group of users by default based on the project. So I wrote a simple script to automatically add
in industrial applications, some files from industrial equipment will be placed in the specified directory, as these files need to be reformatted before being processed by higher-level software. At this point the processing of the script is
1. #annotation function, #! ExceptIn addition, in the parameter replacement echo ${path#*:} here does not represent a comment, a numbering conversion, does not represent a comment echo $ ((2#101011))2.;Command line separator, you can write multiple
Shell if judge commonly used in the green part, the tail part of the more do not understand. Reproduced from Baidu Library.
[-A file] if FILE existence is true.
[-B-file] True if file exists and is a block-specific file.
[-C file] is true if file
Problem background:
#!/bin/shphp=100;Java=101Language= "PHP JAVA"For Lang in $LANGUAGETodoWhat do you want to do with 100, 101 line-by-row output?Done
Workaround-Numeric string:
#!/bin/sh php=100;Java=101Language= "PHP JAVA" for Lang in $LANGUAGE
This script has been tested on the Ubuntu and CentOS versions, and the source code is much more straightforward:
The code is as follows
Copy Code
#!/bin/bash Line= ' =========== ' #linux发行版名称if [[-f/usr/bin/lsb_release]];
There are many ways to intercept strings in the shell,
${expression} A total of 9 ways to use.${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word}4 of the above can be used to replace the default values.${#parameter}The above
The code is as follows
Copy Code
basedirforscriptself=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed script is: ${basedirforscriptself}"Orfullpath=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed
The introduction to shell scripting is what this article is about, and we can use any type of text editor, such as Gedit, Kedit, Emacs, VI, to write the shell script, which must begin with the following line (must be placed on the first line of the
Date# Take the day beforedate-d ' 1 days ago ' +%y-%m-%d
Order, E-Name, set function: (alias)Alias Ll= ' Ls-al '
Some special values$$: (for this shell PID)$!: Get the process pid of the subprocess, for example the Nohup command can get the PID$: (
Day Fifth: Functions and task scheduling
Advantages of the function
Divide and conquer F
Work together
Easy Management
Easy Maintenance
Structure of the function
function functions name ()
{
Command 1
Command 2
Command 3
}
Parameter
1. Example: Insert a record every 100 rows, and the first column of this record contains the line number, and the other columns are the same as the first row
#!/bin/sh
var= "00001" # variable
cat A.txt|awk ' nr==1 ' |while read Line # Get the
First, what is the SCP?
SCP is a secure copy of the shorthand for remote copy of files under Linux commands, and its similar command has CP, but the CP is only on the local copy not across the server, and the SCP transmission is encrypted, may
Implementation code:
#!/bin/sh
# ANSI Color-Use this variables to make output in different colors
# and formats. Color names that end with the ' F ' are foreground (text) colors, # and those ending with
' B ' are background.
Initializeansi
DF command
Disk Management
The DF command is used to display the available disk space on a disk partition. The default display unit is KB. You can use this command to get how much space the hard disk is occupied and how much space is left.
The LS command is used to display which files and folders are in the directoryLsBlue indicates folder White is fileLs-r List the contents of all folders (R = recursive)Ls-l View details including file permissions last modified time size (L for
&& and|| Or# when two files are present[[email protected] ~]# ls 1.txt && ls 2.txt1.txt2.txt# 10.txt file does not exist[[email protected] ~]# ls 10.txt && ls 2.txtLS: Unable to access 10.txt: No file or directory[[email protected] ~]# ls 10.txt | |
Today, the company asked me to copy the backup files on the server to the internal server, and as long as they are up-to-date, well, what is the ideal goal of O & M personnel, that is, what can be done by computers, never do it by yourself.System:
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.