CopyCodeThe Code is as follows: #/bin/bash
# History
# Paste the following code directly to/etc/profile.
User_ip = 'Who-u am I 2>/dev/null | awk '{print $ NF}' | sed-E's/[()] // g''
Histdir =/var/log/. hist
If [-Z $ user_ip]
Then
User_ip =
Shell commandsXargs
Build and execute command lines from standard input
Xargs can be readStdinAnd use a space character or line break character as the resolutionStdinData is separatedArguments.
1) Description
Xargs [-0epn] command
Options
1,Which
Which-shows the full path of (Shell) commands.
Which [Option]
2,Whereis
Whereis-locate the binary, source, and manual page files for a command
Whereis [Option] filename
3,Find
Find-search for files in a directory hierarchy
Find [
Unix-like systems such as Linux always have a single file system tree, regardless
How many drives or storage devices are attached to the computer. Storage Devices
Are attached (mounted) at various points on the tree according to the system
Recently, we are busy developing data synchronization for Douban, mainly because the Douban interface is not powerful and the data cannot be captured when the access volume exceeds a certain value. Therefore, we decided to import Douban data to the
I will take the time to study windows powershell recently.
First of all, it starts with the userguide of powershell itself. Just a rough look at the powershell directory.
Powershell is quite powerful. In powershell, we can process the registry,
The Shell script is mainly used to initialize the new Linux server system, including:
Disable IPv6 ModuleDisable SELinuxShow vim colorsSet system language EncodingOptimize system servicesKernel Parameter optimization.It can be modified according to
Copy codeThe Code is as follows: # include
Using namespace std;
Void ShellQin (int A [], int n)
{
Int gap = n/2;
Int I, j;
For (; gap> 0; gap = gap/2) // set the initial gap, group by gap, and decrease by gap/2
{
// After the gap is set, insert and
Shell script:
1 ,#! Shell for Script Execution2. # comment3. Command or syntax structureEcho "input content"Empty line output by echo
Run:
1. shell scriptSh example2. Grant shell script execution permissionChmod u + x example
Case: example sysinfo.
1. Character truncation:
For normal path truncation, you can use the basename and dirname tools:Basename can intercept a file name from a file path.
For example:
Copy codeThe Code is as follows: $ basename/home/file.tar
File.tar
Dirname can be
The color of the text terminal can be generated using an ANSI unconventional character sequence. Example:
Echo-e "\ 033 [44; 37; 5 m ME \ 033 [0 m COOL"
The above command sets the background to blue, foreground white, blinking cursor, output
Ctrl + a switch to the command line
Ctrl + e switch to the end of the command line
Ctrl + l clear screen content
Ctrl + u clear the content before cutting the cursor
Ctrl + k cut the content after clearing the cursor
Ctrl + y copy the content
When writing a Shell filter process, most people use grep to search for the specified process in the output result of ps aux. However, the grep process is also displayed, for example, the pptpd process, two matching items are displayed:
Copy
First script file
Copy codeThe Code is as follows :#! /Bin/bash
Echo "This is my first bash code! "
Exit 0
Redirection symbols and mathematical computationCopy codeThe Code is as follows :#! /Bin/bashEcho-n "The time and date are :"DateValue1 = 100 #
If you are an IT person who is used to Windows command prompt, when you use Linux Command lines for the first time, you will feel at a loss. The DOS command you are familiar with does not exist in Linux. There are a lot of commands to remember
#! /Bin/bashNAME = javaNOP =/bin/trueDATE = $ (/bin/date + "% Y-% m-% d % H: % M: % S ") ps-ef | awk-F "" '{print $8, $2}' | grep ^ java>/dev/null 2> & 1 case "$? "In0) # It is running in this case so we do nothing. echo "$ NAME is running OK. relax.
Before capturing signals, you must first understand how to use kill:
Kill-l view Signal
650) this. width = 650; "title =" kill-l.jpg "src =" http://www.bkjia.com/uploads/allimg/131227/2315524596-0.jpg "alt =" 225340553.jpg"/>
Usage:
Kill-NUMBER
Introduction:
In the production environment, the application service generates fixed log files by date every day. Developers often need O & M personnel to provide these application logs, sometimes for a single day, sometimes for a period of time,
1. Output inbound Steering
In UNIX, each process has three special file descriptor standard inputs.(Standard input), standard output, and standardError ). The three normally accept terminal input, which is displayed by terminal. HoweverUNIX provides
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