Usage:
#> Moniotr. Sh eth0 1
#! /Bin/bash
# Test network width# The first parameter indicates the Real-Time refresh time after the NIC name. 1 indicates 1 second.
Function usage{Echo "Usage: $0"Echo "e.g. $0 eth0 2"Exit 65}If [$ #-lt 2]
Xcode statisticsCodeIt is very simple to use shell commands. Open the terminal, enter your project directory, and execute the following code
Find.-Name "*. m"-or-name "*. H"-or-name "*. html"-or-name"*. C" | xargs WC-l
To collect statistics on
''Causes sed Command Parsing to fail. The experiment is as follows:
Try to replace a single backslash with two backlash, that is\ Replace \\
$ Cat t1.sh#! /Bin/shA = 'echo 1 | SED's/\/g''Echo $
$./T1.shSed:-e expression #1, character 8:
Similar to awk Functions
Example 1
$ A = 'echo root: X: 0: 0: Root:/root:/bin/bash | cut-D: -F 1,5 'shuohailhl @ shuohailhl-PC/cygdrive/d $ echo $ aroot: Root
In the preceding example, the root: X: 0: 0: Root:/root:/bin/bash command is
/*************************************** ******************************* Author: Samson* Date: 08/18/2012* Test Platform:* GNU Linux version 2.6.29.4* GNU bash, version 4.0.16 (1)-release (i386-redhat-linux-gnu)
************************************
Shell built-in command Exec
Shell's built-in command exec is very interesting. It will not start a new shell, but will replace the current shell process with the command to be executed, and clean up the environment of the old process.
Other
Common RPM parameters for these tasks !!! In Linux, you can run man rpm !!! It's only in English, or you can get Baidu RPM !!! I 'd like to paste a few below !!!! Common RPM commands 1. install a package # rpm-IVH 2. upgrade a package # rpm-uvh 3.
Write a script:1. Create a directory/tmp/scripts2. Switch the working directory to this directory.3. Copy the/etc/PAM. d directory to the current directory and run the test command again.4. Change the owner of test and its files and subdirectories
In Linux, The SED command is used to replace the text. The command that matches the regular expression can be replaced flexibly with SED, which greatly reduces the workload. It can be said that SED is the main force of replacement in shell scripts
1. Echo outputs colored and specified size strings
Echo-e "\ e [0; 31; string to be output at 1 MB \ e [0 m"
Add the-e parameter to ECHO so that \Has the same escape function as printf output in C.
\ E [0; 31; 1 M indicates that the output character
It has the most basic mathematical computing capabilities in shell, such as expr and let. However, these operations can only process integer data. To calculate decimals, you must use the BC command extension. The following example shows how to
MAC system startup process
See:
Http://hi.baidu.com/%CB%E6%B7%E7%B6%F8%D0%D01999/blog/item/271d20a694d7d49dd0435842.html
1 MAC boot STARTUP script or application (run shell script when the system starts)
1) if you want to start a Mac application
Unix shell programming (4)
Cut commandYou can extract the required data fields from the data file or command output.Command Format: Cut-cchars FileChars indicates the characters to intercept, which can be numbers.File indicates a file. If file is
In shell, you can convert a string to a timestamp as follows:
Date-d "2010-10-18 00:00:00" + % s
Output Format:
1287331200
The-D parameter indicates the time indicated by the specified string, and + % s indicates the output timestamp.
The
Basic Unix shell script Test1. Which of the following code lines will print your previous working directory to the screen? CA. Echo ~B. Echo $ pwdC. Echo ~ -D. Echo *2. Which of the following symbols can be used to redirect the command output to a
1. Using securitycrt in the options-> session Options dialog box, there are many options for emulation under terminal. the Linux server has different terminal simulation packages called the terminfo database, each type corresponds to a terminfo File
Shell script compiling basics in Linux, although there are a variety of graphical interface tools, token is still a very flexible tool. Shell is not only a collection of commands, but also a very good programming language. You can use shell to
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