Note: After the awk command, there are not too many complex commands, which are basic commands.
Description
Cat, which is the abbreviation of the word concatenate, outputs the contents of the file to stdout. When the redirection operator (> orWhen
The tree command is the protagonist of printing files and directories in a graphical structure. This command is not normally included in Linux distributions. You need to install it yourself with the package Manager.
Instance:
1. Tree
Print all
1. Print some header informationCommand ............Dilimiter
The standard input of the command as the content of the boundary symbol DilimiterCommonly used in the echo command, this avoids the need to use an echo command without outputting a line,
Copy Code code as follows:
#!/bin/bash
#This the script is Usage for describle CPU Hard memery Utilization
Total=0
Idle=0
System=0
User=0
Nice=0
Mem=0
Vmexec=/usr/bin/vmstat
Which SAR >/dev/null 2>&1
If [$?-ne 0]
Then
Ver= '
Like the following text:ABCD 1234 FDS2011 5501023 832er 1231
The request is processed as follows:ABCD 1234 FDS2011 550total1:1023 Total2:832er 12end
Determine if the last line of text is preceded by the first column with Total1: The second column
DF, free disk, is used to display the disk usage of the file system. By default, the DF command will display all currently mounted file systems in each 1K unit, if you want to display the output of the DF command in a human readable format, such as "
Copy code code as follows:
#
Is it really a headache, or do you want to write a shell script to get rid of these scripts
Copy Code code as follows:
#!/bin/sh
LS $1/*.htm | While read file
Todo
Sed-i-E "/if (
In simple terms, this technique corresponds to the following scenario
Suppose there is text as follows
Copy Code code as follows:
Cccc
Aaaa
bbbb
dddd
bbbb
Cccc
Aaaa
Now it needs to be processed, this is simple,
Use shell script to compute the Linux NIC traffic, the most critical point in the method:
Copy Code code as follows:
Ifconfig $eth _name | grep bytes | awk ' {print $} ' | Awk-f: ' {print $} '
The flow of input and output is
1, File type introductionLinux systems mainly include the following seven types of files: D directory-normal file L Symbolic link s socket file B block device file c character device file p named pipe file
2, Regular expressionRegular expressions
This paper introduces several common Linux monitoring scripts, which can realize the automatic monitoring and alarming of host network card traffic, system condition, host disk space, CPU and memory usage. According to their own needs to write a
The first description of our configuration file, are similar format, if the intranet is 192.168.0.3, the extranet is 123.123.123.123, the configuration file is as follows:
$db [' salver '] [' hostname '] = ' 192.168.0.3:3306 ';$db [' salver '] ['
Port forwarding under Windows is typically a self-contained NAT and Porttunnel, Portmap
Linux Lower port forwarding mapping program called RINETD, boot method rinetd-c/etc/rinetd.conf, Pkill rinetd shutdown process
Tools Home:
There are many examples of shell script-reading text files on the web, but they don't tell the whole story, only half of it. For example, read a text line from a testfile file in the following format:
Copy Code code as follows:
$ VI
Most people will change it when they use Bash, because the default settings are really hard to use.
Refer to the following ~/.INPUTRC settings:
Copy Code code as follows:
# don't show hidden files in the list
Set Match-hidden-files off
Today, my company colleagues came to me and said that I was going to execute the Python script on the server with another user, but it was always done by the root user in the crontab, so I thought of a lazy way to use the shell script to switch to
The last time we sent a Python update Google hosts script, today saw someone sent a shell to get Google hosts script, I took to a slightly more simple processing, the following gives you the shell version of the update of Google hosts script.
The company server has been dying for the last two days because of the full memory usage. Really can't stand the old call room to help people to restart, specifically wrote a script to release the memory, of course, this server is not too important,
What I want to say here is the parentheses in several shells, the braces and the bracketed variables, and the use of the command, as follows:
1.${var}2.$ (CMD)3. () and {}4.${var:-string},${var:+string},${var:=string},${var:?string}5.$ ((exp))6.$
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.