Today, we found that gitbash can be directly opened in shell. gitbash provides some useful Linux-style commands. The most important thing is that you do not need to open another gitbash terminal to manipulate git when using Emacs.
In ~ The
1. Use multiple commands
To run multiple commands together, you only need to input them to the same line, separated by semicolons.
Ex: data; WHO 2. Create a script file
(1) #! /Bin/bash is the first line
(2) # Add comments.
(3) Each line
I saw a command line prompt from my colleagues on my system (Linux), which had a color and smiling face.
I think it's cool, and I also copied it,
Display Policy: current user, time, current directory,
If a common user displays a smiling face,
1. write scripts. You can use shell and Perl. Find 100 files starting with ABC in the/tmp directory, and save the first line of these files to file new.2. write scripts and use shell and Perl. Put all the rows in file B but not in file,Save as file
@ Rigorous use of set @
Set-eux
-E. If the command returns a non-zero value, exit immediately.
-U when the execution parameter is included, the unset variable is used as the error handling (if the extension attempt appears in the unset variable, the
Ls-l dir1 | WC-L.
1. While condition; do done // () [] Test2. Until is the same as above. It is executed only when the condition is not true.3. /Dev/null: Unix black hole. Used to clear the file CAT/dev/null> XX find-name a.txt 2>/dev/null4. Note:
Use Find and SED
# First query the number (sed-N)
Find.-Name '*. htm' | xargs sed-n'/old/P'
# Replace (sed-I)
Find.-Name '*. htm' | xargs sed-I's/old/new/G'
Use grep and SED
Grep-l old *. htm | xargs sed-n "/old/P"Sed-n'/old/P' grep-l old *.
Linux system resource load is too high and Apache shell script is automatically restarted
When we routinely maintain Apache Web servers in Linux, the endless loop caused by crawler crawling cannot jump out, or the collection of data from peers
-B file: if the file exists and is a special block file, it is true.-C file: if the file exists and is a special character file, it is true.-D file: if the file exists and is a directory, it is true.-E file: true if the file exists-F file: if the
Forwarded from blog: http://www.51testing.com /? Uid-390472-action-viewspace-itemid-232903
TimeCommand is used to print the execution time of a command or program.Time
The time, system time, and time used in the execution of a command in
Document directory
Determine whether the file is a device file
Add User:
IP address access statistics:
Calculate the sum of 2 numbers
Text Analysis
File Sorting
Print the swap partition size of the Local Machine
Output the time used to
6th hours Process
6.1 start a process
In UNIX, whenever a command is executed, it creates or starts a new process.
For example, when you use the LS command to list a directory, a process is started.
The operating system uses a five-digit ID called
Lesson 6 variables
Part 2 shell programming
7.1 define variables
Format: Name = value # Note: there cannot be spaces on both sides of the equal sign!
This is different from other scripting languages: value can be defined as a variable value without
14th class hour Functions
14.1 create and use functions
Format: Name () {list ;}
An important feature of Shell functions is that they can be used to replace binary executable files or shell built-in commands with the same name.
For example:
CD () {
Obtain the date of the current day
Date + % Y-% m-% d
Output: 2011-07-28
Assign the current date to the date variableDate = $ (date + % Y % m % d)
Sometimes we need to use the date before or after today, then we can use the-D parameter of
Common System Variables$0 name of the current program$ N the nth parameter of the current program, n = 1, 2 ,... 9$ * All parameters of the current program (excluding the program itself)$ # Number of parameters of the current program (excluding the
Example 5 insert some content after some strings
[Rocrocket @ rocrocket programming] $ cat mysed.txtBeijingLondon [rocrocket @ rocrocket programming] $ SED's/B. */& 2008/'mysed.txtBeijing2008London
The purpose of this command is to add the following
My platform: Ubuntu 10.04Solution 1:Lsusb, view the vendorid, and add or modify the 51-android.rules file in the/etc/udev/rules. d/directory.Add a record:Subsystem = "USB", sysfs {idvendor} = "XXXX ",Mode = "0666" where XXXX is the value obtained
In Java, you can call the Execcommand method to run the shell script. The following is an example:
1 .#! /System/bin/sh
2. # The simplest shell with no function
3. # It must be noted that #! Start with/system/bin/sh (with spaces)
4. # different from
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