Today to optimize the company's new deployment servers, found that the TTY terminal has 6, in order to save a bit of memory, decided to leave only a TTY terminal, the others are off, but CENTOS6 and centos5 terminal closure method completely changed,
This script has been tested on the Ubuntu and CentOS versions, and the script is as follows:
Copy Code code as follows:
#!/bin/bash
Line= ' =========== '
#linux发行版名称if [[-f/usr/bin/lsb_release]]; Thenos=$ (/usr/bin/lsb_release-a
Customer requirements, do not want to allow foreign IP to access the server, would have to let the computer room in the upper route to solve, but those people do not bird you!!! ~~~~In this case, you can only use iptables to solve the ~~~~~~~~~About
Components used to query IP addresses
Copy Code code as follows:
wget http://rfyiamcool.googlecode.com/files/nali-0.1.tar.gz
Tar zxvf nali-0.1.tar.gz
CD nali-0.1
./configure && make && make install
The steps and Nginx are
Parameters:Pathname, the path file name of the temporary file is stored, and the manual free () is required.Dir, the path to the temporary file, if the TMPDIR environment variable is not empty, this parameter is ignored and the environment variable
1, look at the machine installed which shell?
There are two ways to view it.
First type:
[Rocrocket@wupengchong ~]$ Chsh-l/bin/sh/bin/bash/sbin/nologin/bin/zsh
The second type:
[Rocrocket@wupengchong ~]$
Case statements in the shell:You can match the contents of a variable with multiple templates, and then decide which part of the code should be executed based on a successful matching template.
Use format:Case matching Parent board inTemplate 1 [|
One, logical operators
Logical Volume Label
Express meaning
1.
About the files and directories of the detection of logical labels!
-F
Common! Detect the existence of "archives" eg:if [-f filename]
Why should I include a header file instead of a. c file
Test code:
Copy Code code as follows:
M.C file:
#include "t.c"
int main ()
{
Test ();
return 0;
}
Compile:
Copy Code code as follows:
GCC M.
Copy Code code as follows:
#!/bin/bash
function Pinghost {
Ping $1-c 1-w |grep rtt|cut-d "/"-f6
}
Tmp_fifofile= "/tmp/$.fifo" # script runs the current process ID number as filename
Mkfifo $tmp _fifofile # Create a new random FIFO pipeline
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
Today suddenly think of a problem has not hands-on practice, is the use of Shell batch modification file suffix, now hands-on practice.
Requirements: The home directory has some SQL files, want to bulk renamed into TXT
1, find + xargs +sed
Array as a data structure, in some high-level languages are directly provided and implemented, of course, my shell is also some ha.
PS: This article is written because brother B in the group sent a screenshot:
My big B elder brother is still
The recent systematic study of the shell function, the overall sense of the root of the other language function is similar, but it also has its own characteristics
One, the call function must be defined after the function, or it will be the error
When you write a shell script on a Linux operating system, we use the $ symbol in front of the variable to get the value of the variable, usually in the script using the "$param" in a double quote format, but there are also the use of the ' $param '
[grep Introduction:]
grep is used to filter rows that contain specific characters, and to use regular expressions to search for text that is selected in positive behavior units when looking up a string in the data.
Usage: grep [Cinvs] ' pattern '
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The case statement
What is a shell, what can you do?1. ProceduresNarrow: Operating system programs and applications.The operating system program is used to invoke the monitoring kernel, which runs all the programs we can apply on this operating system.The operation of
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