First, create test files test.sh
#!/bin/sh
./etc/profile
# Parameters:
# Args[0], data date, date format Yyyy-mm-dd
# Take 30 days before the date
function Get_date_ 30daysbefore ()
{
sec= ' date-d $ +%s '
sec_30daysbefore=$ ((sec-86400*30))
In general, use the "Telnet IP port" to determine the port pass, in fact, testing methods more than this one, there are many ways, the following small series to share several methods, the specific content please look down:
Preparing the Environment
The shell may often see: >/dev/null 2>&1
The result of the command can be defined as the output in the form of%>
/dev/null represents empty device files
> represents where to redirect, for example: echo "123" >/home/123.txt
1 indicates stdout
Provides an operational expression in the following format: $ ((expression))
$ echo $ ((5* (3+3))
30
$ result = $ (($myvar-10))
The shell provides a convenient number of conversions between:
$ echo $ ((013)) #八进制
$ echo $ ((0xa4)) #十六进制
You can
4.1 Sort Text
Sort of 4.1.1 RowsWhen command-line options are not provided, the entire record is sorted according to the order defined by the current locale.In the traditional C locale, which is the ASCII order.
4.1.2 Sorted by FieldThe-K option
RPM is a red Hat (REDHAT) package management tool that implements features like Add/Remove Programs in Windows
RPM-IVH install_rpm
Tar xvf Informix-linux.tar
Inux to extract the command Daquan
. tarUnpack: Tar xvf Filename.tarPacking: Tar cvf
Because the Linux production environment to build a lot of steps, it is cumbersome and necessary steps. Although it has been done many times, but because of the cumbersome steps, it is easy to forget, the following small set up a time to build the
1. Automatic Ssh/scp method
A is a local host (that is, a machine used to control other hosts);b is a remote host (that is, a controlled machine server), if IP is 192.168.60.110;Both A and B systems are Linux.
To run a command on a:# ssh-keygen-t
Copy Code code as follows:
#! /bin/sh
# filename killcpu.sh
If [$#!= 1]; Then
echo "USAGE: $ "
Exit 1;
Fi
For i in ' seq $ '
Todo
Echo-ne "
i=0;
While True
Todo
i=i+1;
Done "| /bin/sh &
pid_array[$i]=$!;
Done
Copy Code code as follows:
#!/bin/sh
Mypath= "/var/log/httpd/"
Myfile= "/var/log/httpd/access.log"
#这里的-x parameter to determine whether $mypath exists and has executable permissions
if [!-X "$myPath"]; Then
mkdir "$myPath"
First, debug scripts
Debugging is one of the important features that every programming language should implement, and when something unexpected happens, use it to generate the running information of the script, and the debugging information can
Because the work needs, often from the Windows host to access the remote Ubuntu server, each input account and the old password, feel very troublesome, so the reference online tutorial simple set up can automatically login remote host, very
How to identify the number of physical CPUs, a few cores, is hyper-threading or multi-core
Judge the basis:
1. CPUs with the same core ID are the same core hyper-threading.2. CPUs with the same physical ID are the same CPU-encapsulated threads
On the realization of the double linked list, the general textbook defines a two-way linked list node in the following ways:
Copy Code code as follows:
struct list_node{
Stuct List_node *pre;
Stuct List_node *next;
Elemtype data;
1. Understanding Bash
Through the shell will input the instructions and kernel communication, let kernel control hardware workView Shell:cat/etc/shellA preset shell type is recorded in the/etc/passwd after login and is related to the accountCommand
Today, when writing a shell script to find that you need to set the user's password, and set the password is interactive, so in the script is obviously not very good, so the Internet to find data, found the following two common way to set the
CSH Example Reference:
Copy Code code as follows:
#!/bin/csh-vx
#csh-VX Show the command before running to help debug
#just to check syntax#csh-N $
#argvif ($ #argv echo "Sorry, but you entered too few parameters"echo "Usage: $
1. List all directory usage and sort by size.
Copy Code code as follows:
Ls|xargs Du-h|sort-rn
#不递归下级目录使用du-sh
2. View the file exclusion with the # switch and blank line, suitable for viewing the configuration file.
Copy
Nodejs is really very hot, before the past, but never seriously recorded anything. Build its development environment under Ubuntu Try a quick, easy way to get the system to automatically help you install what you need, and we'll generate a shell
The Asia Pacific Network information is recorded here, updated every day.
Http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
The following script will edit this text, output several major network segments of the domestic operators.
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