2010年8月21日星期六

CentOS ulimit system command changes

In CentOS ulimit to explain to you before, let us know the next CentOS ulimit, then a comprehensive introduction CentOS ulimit, hope to be useful. CentOS ulimit value (Linux file handle number) in CentOS5 (RHEL5) of the adjustment.

Following the deployment of applications in Linux, when sometimes encounter Socket / File: Can't open so many files in question, such as Squid do have agency, when the file open count of more than 900 per hour will drop very fast, there is could not open page.
In fact, Linux is a file handle limit, and Linux the default is not very high, typically 1024, the production server is actually very easy to achieve with this number.

View Methods
We can use CentOS ulimit-a to view all limit
[Root @ centos5 ~] # Centos ulimit-a
core file size (blocks,-c) 0
data seg size (kbytes,-d) unlimited
max nice (-e) 0
file size (blocks,-f) unlimited
pending signals (-i) 4096
max locked memory (kbytes,-l) 32
max memory size (kbytes,-m) unlimited
open files (-n) 1024
pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-q) 819200
max rt priority (-r) 0
stack size (kbytes,-s) 10240
cpu time (seconds,-t) unlimited
max user processes (-u) 4096
virtual memory (kbytes,-v) unlimited
file locks (-x) unlimited | | < Which "open files (-n) 1024" is the Linux operating system, a process the number of open file handles limit (also includes the number of open SOCKET, MySQL can affect the number of concurrent connections). This value can be used CentOS ulimit command to modify the However, CentOS ulimit command changes the value only for the current logged-on user's current environment and effective, system restart or user exits will be invalid. Overall system limit is here, / proc / sys / fs / file-max. Can see the current value of cat, modify / etc / sysctl.conf can also be controlled. There is also a, / proc / sys / fs / file-nr, can see the whole system, the number of file handles currently in use Find file handle problem, there is a very useful program lsof. Can be easily opened to see who handles a process. You can also see a file / directory is what the process of taking up. Modification method To make permanent changes CentOS ulimits numerical effect, you must modify the configuration files, you can modify to CentOS ulimit command into / etc / profile which, this method is not convenient, there is a way to modify / etc / sysctl.conf . I modified, tested, but the CentOS ulimits-a user will not change. But / proc / sys / fs / file-max value has changed. (I give the command into the rc.local of failure) I think the right thing to do is modify the / etc / security / limits.conf There are very detailed notes, such as * Soft nofile 32768 * Hard nofile 65536 Can also be run directly below the shell. Copy directly to your terminal to run just fine. echo-ne " * Soft nofile 65536 * Hard nofile 65536 ">> / Etc / security / limits.conf

Restrictions on the file handle can be unified into soft-32768 hard 65536. Configuration file is the front of the domain, set to star on behalf of the overall situation, plus you can make a different for different users limit attention. That among the hard limit is the actual restrictions, and soft constraints, is warnning restrictions will only make the warning. In fact, CentOS ulimit command itself is divided soft and hard settings, add-H is hard, add-S is the soft limit by default shows the soft If running CentOS ulimit command does not modify the time with it, are two parameters change with it. effect
Re-login to see modifying. (My system is CentOS5.1. Revised and re-login after immediately. Can use CentOS ulimit-a view confirmed.)
If you are using squid, you should be in / etc / init.d / squid file join CentOS ulimit-HSn 65535. In addition, in squid.conf should join max_filedesc 16384

Eight Windows system command prompt special skills

I believe most people have already familiar with Le De Microsoft Windows user interface, but not all the features Bixujiezhu Ta can be achieved, so even in Windows 2000 and Windows XP li still Baoliu the Lei Si DOS command window, Dangrantamen and Yi Wang Windows 9x version under the command window there are many different, and therefore there are many special application skills, we might take a look together.

Click the "Start → Programs → Accessories → Command Prompt" or "Start → Run," and then enter "CMD" into the command can be prompt.

1 Using automatic memory function

Command window with the command and memory function, you enter in the window all the command line will be automatically memory down, by clicking up and down arrow keys on the keyboard can be the command just entered one by one taken out of tune, similar to the DOS in the DOSKEY instructions It just built this instruction in the command window. This memory can relieve you of the pain of repeatedly enter the same commands, for network debugging environment is particularly useful, can save you a lot of duplication of effort and valuable time.

2, fun prompt

You will be imagined to make your command prompt into the present time? Can display the current Windows XP version number? If you want to be able to achieve. Here we will teach you how to achieve.

Here we make use of a prompt in the DOS command, which a lot of useful parameters, the role of detailed parameters prompt the reader in the state of running prompt /? To Search. Understanding of the role of these parameters, you can create a path in the install file, name it as run.bat, the contents of the folder for the prompt $ V $ D $ G $ G. Next, open the Registry Editor, and then click Browse to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Command Processor \, then double-click on the right of the AutoRun key, be revised to% systemroot% \ run.bat, save your settings exit. Re-open the command prompt, how is not made changes. In fact, according to prompt the parameters as long as you can define your own rich text prompt.

3, copy the contents of the window

Copy of the string in terms of useful window for the command. But Windows 2000 and Windows XP command prompt copy, quite different from previous versions, even if not the same between the two, the former is the use of marker replication method, while the latter directly by right-clicking the replication method. Specifically described as follows:

In Windows XP, the for all, you can click the right mouse button in the "Select" to select, and for the contents of the specified range, you can right click the first election in which the "marked" item, then move the mouse to The command character to be copied Department, drag the mouse to select this string, the string will appear immediately in the form of anti-white screen, click the right mouse button or press the Enter key, then move to the target location, right-click and select "Paste "Such a command string is automatically copied to the specified location.

In Windows 2000 下, as in the command window does not support the right of the menu (Dan supports drag the mouse of choice), so it gives up one kind of simplicity of the Fang Shi Yong Geng Wei-day command characters of Fu Zhi, first you must hold down the left mouse button, drag the selected command string to be copied, they will be anti-white form on the screen, first click the mouse to the right (ie implementation of the copy operation), move your mouse over the target location, and then click the left mouse key, the command character is automatically pasted into a new location on the!

4, change the window properties

If you long to work at the command prompt can also self-adjust its appearance to suit their habits, such as their window title, color and other personalized settings, frequent use of the relevant commands are:

a) change the title: CMD / k TITLE new title name

b) to change the command character: CMD / K PROMPT [text] (text for the new command prompt)

c) to change the foreground and background colors: CMD / t: gf (g is the background color specified in hexadecimal numbers, common color have the following values: 0 black, 1 blue, 2 green, 3 light green, 4 red , 5 purple, 6 yellow, 7 white, 8 Gray, 9, light blue, A light green, B blue, C light red, D light purple, E pale yellow, F white light.

5, the command window shortcut keys

In the command window has many useful shortcut keys, can greatly accelerate the speed of your input and debugging, but some of the features also provide a graphical way.

ESC: Clear the current command line;

F7: Display the command history in the form of a graphic window shows a list of all who enter the command, and can be up and down arrow keys to select again the implementation of the order.

F8: search command history, cycle show all who enter the command, press the Enter key until the date;

F9: select the command by numbers, graphical dialog box asking for your input command corresponding to the number (starting from 0), and the order displayed on the screen;

Ctrl + H: Remove the cursor left one character;

Ctrl + C Ctrl + Break, forced suspension of command;

Ctrl + M: said press Enter key;

Alt + F7: Clear all who enter the command history;

Alt + PrintScreen: interception of the screen window of the contents of the current command.

6, good "color" of the command line

By default command line is always black and white, from where the first surgery. In the Run dialog box, type cmd, open a command prompt, in the open right click on the title of the window, the pop-up menu, select "Properties" and open the window switch to the "Color" tab, and then click to select screen text, screen background options, and set the appropriate color, note that when we changed settings Shi Shi Zhi Hou will be displayed at the bottom, under which we can enjoy in a timely manner according to their own adjustments to make after the application save the settings will be asked properties, choose "Save property for later use with the same title of the window," so they would not only effect the current window.

7, quickly select files and folders

At the command prompt, we can press the Tab key to select the current directory the following files and folders, and its order of selection the basis of certain assessment, 按下 Shift + Tab key combination can also be used against the direction of choice, is convenience. Note that at this time we have chosen document also includes hidden files included.

8, save the file list information

Sometimes we need to drive in the list of files in a directory of all information printed, then you can use the following method: type the command DIR> C: \ 1.TXT after the carriage return, so the current directory list of files will be saved to C disk 1.txt file.

mount command Xiangjie

Function: load the specified file system.
Syntax: mount [-afFhnrvVw] [-L

Common command rpm

1. Install a package
# Rpm-ivh

2. Upgrade a package
# Rpm-Uvh

3. Remove a package
# Rpm-e

4. Installation Parameters
- Force even if the cover package of documents belonging to others forced to install
- Nodeps if the RPM package installation depends on other packages, even if no other packages installed, but also to force installation.

5. Check whether a package is installed
# Rpm-q

6. Get the information package to be installed
# Rpm-qi

7. Out of the package in which files
# Rpm-ql

8. Listed on a file server to which they belong RPM package
# Rpm-qf

9. Can be integrated with the use of several parameters
# Rpm-qil

10. Lists all installed rpm package
# Rpm-qa

11. Listed are not installed into the system an RPM package file which contains files?
# Rpm-qilp

<>
First, install the

Command format:

rpm-i (or - install) options file1.rpm ... fileN.rpm

Parameters:

file1.rpm ... fileN.rpm will be installed RPM package file name

More options:

-H (or - hash) hash mark (``#'') installed output
- Test only to test the installation, not the actual installation.
- Percent in the form of output as a percentage of the progress of installation.
- Excludedocs not install packages in the document file
- Includedocs installation documentation
- Replacepkgs forced to re-install already installed package
- Replacefiles replacement documents belonging to other packages
- Force Ignore package and file conflicts
- Noscripts not run pre-installation and post-installation script
- Prefix the package installed by the specified path
- Ignorearch do not check the structure of package
- Ignoreos run the operating system does not check package
- Nodeps do not check the dependency relations
- Ftpproxy used as a FTP proxy
- Ftpport FTP port number specified

General Options

-V Display additional information
-Vv display debugging information
- Root for the specified path as the RPM will be the "root directory", so that after pre-installation procedures and safety
Installation program will install to this directory
- Rcfile file set rpmrc
- Dbpath RPM information to set the path where inventory

Second, delete

Command format:

rpm-e (or - erase) options pkg1 ... pkgN

Parameter

pkg1 ... pkgN: To remove the package

More options

- Test only delete the test implementation
- Noscripts not run pre-installation and post-installation script
- Nodeps Do not check dependencies

General Options

-Vv display debugging information
- Root for the specified path as the RPM will be the "root directory", so pre-and post-installation setup
Program will be installed to this directory
- Rcfile file set rpmrc
- Dbpath RPM information to set the path where inventory

Third, upgrade

Command format

rpm-U (or - upgrade) options file1.rpm ... fileN.rpm

Parameter

file1.rpm ... fileN.rpm package name

More options

-H (or - hash) hash mark (``#'') installed output
- Oldpackage allow the "upgrade" to an old version of the
- Test only upgrade testing
- Excludedocs not install packages in the document file
- Includedocs installation documentation
- Replacepkgs forced to re-install already installed package
- Replacefiles replacement documents belonging to other packages
- Force Ignore package and file conflicts
- Percent in the form of output as a percentage of the progress of installation.
- Noscripts not run pre-installation and post-installation script
- Prefix the package installed by the specified path
- Ignorearch do not check the structure of package
- Ignoreos run the operating system does not check package
- Nodeps do not check the dependency relations
- Ftpproxy used as a FTP proxy
- Ftpport FTP port number specified

General Options

-V Display additional information
-Vv display debugging information
- Root for the specified path as the RPM will be the "root directory", so pre-and post-installation setup program will install to this directory
- Rcfile file set rpmrc
- Dbpath RPM information to set the path where inventory

4, the query

Command format:

rpm-q (or - query) options

Parameters:

pkg1 ... pkgN: check installed packages

More options

-P (or ``-'') check the file package
-F query belongs to which package
-A check of all installed packages
- Whatprovides query a feature of the package
-G queries the packages belonging to group
- Whatrequires check the package all the necessary functions

Information Options

Show all packages identification
-I display a summary of the information package
-L display list of files that the package
-C show a list of configuration files
-D displays the document file list
-S Display the package list of files and display the status of each file
- Scripts show install, uninstall, verify script
- Queryformat (or - qf) is displayed to the user specified query information
- Dump display each file all the parity information
- Provides display package provides the functionality
- Requires (or-R) shows the functionality required package

General Options

-V Display additional information
-Vv display debugging information
- Root for the specified path as the RPM will be the "root directory", so pre-and post-installation setup program will install to this directory
- Rcfile file set rpmrc
- Dbpath RPM information to set the path where inventory

5, check the installed package

Command format:

rpm-V (or - verify, or-y) options

Parameter

pkg1 ... pkgN going to check the package name

Package Options

-P Verify against package file
-F check their packages
-A Verify check all packages
-G checking all packages belonging to group

More options

- Noscripts script does not run check
- Nodeps do not check dependencies
- Nofiles not verify file attributes

General Options

-V Display additional information
-Vv display debugging information
- Root for the specified path as the RPM will be the "root directory", so pre-and post-installation setup program will install to this directory
- Rcfile file set rpmrc
- Dbpath RPM information to set the path where inventory

6, check the paper package

Syntax:

rpm-K (or - checksig) options file1.rpm ... fileN.rpm

Parameters:

file1.rpm ... fileN.rpm package file name

Checksig - more options

- Nopgp not verify PGP signature

General Options

-V Display additional information
-Vv display debugging information
- Rcfile file set rpmrc

7, other RPM options

- Rebuilddb rebuilding RPM database
- Initdb to create a new RPM database
- Quiet reduce output as much as possible
- Help Show help file
- Version display the current version of RPM