Linux instructions (2)

Source: Internet
Author: User
Tags superuser permission

Name top
Permission: All Users
Usage: top [-] [d delay] [q] [c] [S] [s] [I] [n] [B]

Description: displays the process status in real time.

Count

D: Change the display update speed, or press s in the interactive command Column
Q: there is no delay in display speed. if the user has the superuser permission, top will be executed in the highest priority.
C: Switch the display mode. There are two modes: one is to display only the name of the execution file, and the other is to display the complete path and name S: accumulative mode, the CPU time of the completed or deduplicated sub-itinerary (dead child process) is accumulated.
S: security mode. Cancel negotiated commands to avoid potential crisis.
I: Do not display any idle (idle) or useless (zombie) itinerary
N: number of updates. After the update is completed, the system will exit the top
B: The batch file mode, used together with the "n" parameter, can be used to output the top result to the file.

Example:
It is displayed that the system exits after 10 updates;
Top-n 10

The user will not be able to use the negotiated command to run the following commands on the itinerary:
Top-s

Input the result of the second update display to the file named top. log:
Top-n 2-B <top. log

Name: skill

Permission: All Users

Usage: skill [signal to send] [options] Select Program rules

Note:

Send a signal to the executing program. The preset message is TERM (interrupted). The commonly used messages are HUP, INT, KILL, STOP, CONT, and 0.

There are three ways to write messages:-9,-SIGKILL, and-KILL. You can use-l or-L to list available messages.

General parameters:

-F Fast mode/not completed

-I interaction mode/each action is to be confirmed

-V: Detailed output/list information of the selected Program

-W smart warning message/not completed

-N no action/show program code

Parameter: the rule for selecting a program can be the terminal code, user name, program code, and command name.

-T Terminal code (tty or pty)

-U User Name

-P program code (pid)

-C command name:

The following lists known signal names, signal codes, and functions.

Name (CODE) function/Description

ALRM 14 exit

HUP 1 quit

INT 2 exit

KILL 9 exit/force close

PIPE 13 quit

POLL left

PROF leaves

TERM 15 exit

USR1 left

USR2 left

Leave VTALRM

STKFLT exit/Only applicable to i386, m68k, arm, and ppc hardware

UNUSED exit/Only applicable to i386, m68k, arm, and ppc hardware

TSTP stops/generates content-related behaviors

TTIN stops/generates content-related behaviors

TTOU stop/generate content-related behaviors

STOP/force close

CONT restarts/if it is in the stopped status, it is restarted; otherwise, it is ignored.

PWR ignore/will leave in some systems

Ignore WINCH

CHLD ignore

ABRT 6 Core

FPE 8 core

ILL 4 Core

QUIT 3 Core

SEGV 11 core

TRAP 5 Core

SYS Core/perhaps not yet implemented

EMR Core/perhaps not yet implemented

BUS Core/Core failure

XCPU Core/Core failure

XFSZ Core/Core failure

Example:

Stop all programs on the PTY Device
Skill-KILL-v pts /*

Stop three users: user1, user2, and user3
Skill-STOP user1 user2 user3


Other related commands: kill


Name: expr

Permission: All Users
### String Length

Shell> expr length "this is a test"
14

### Digital business count

Shell> expr 14% 9
5

### Capture strings from locations

Shell> expr substr "this is a test" 3 5
Is

### Number string only the first character

Shell> expr index "testforthegame" e
2

### True string Reproduction

Shell> expr quote thisisatestformela
Thisisatestformela

 

Name: tr

### 1. For example, if you want to replace all the upper-case file names in the directory with lower-case file names?

There seems to be many ways, "tr" is one of them:

#! /Bin/sh

Dir = "/tmp/testdir ";
Files = 'Find $ dir-type F ';
For I in $ files
Do
Dir_name = 'dirname $ I ';
Ori_filename = 'basename $ I'
New_filename = 'echo $ ori_filename | tr [: upper:] [: lower:] '>/dev/null;
# Echo $ new_filename;
Mv $ dir_name/$ ori_filename $ dir_name/$ new_filename
Done


### 2. self-testing... lowercase to uppercase

Tr abcdef... [del] ABCDE... [del]
Tr a-z A-Z
Tr [: lower:] [: upper:]

Shell> echo "this is a test" | tr a-z A-Z> www
Shell> cat www
THIS IS A TEST

### 3. remove unwanted strings

Shell> tr-d this ### remove the relevant t. e. s. t
This

Man
Man
Test
E

### 4. Replace the string

Shell> tr-s "this" "TEST"
This
TEST
Th
TE

 

Command: clear
Purpose: Clear the screen.

Usage: enter clear on the console.


Name: reset, tset
Usage: tset [-IQqrs] [-] [-e ch] [-I ch] [-k ch] [-m mapping] [terminal]

Instructions for use:

Reset is actually the same command as tset. It is used to set the status of the terminal. Generally, this command automatically determines the type of the current terminal from the environment variable, command column, or other configuration files. If the specified type is? This program requires the user to enter the terminal type.

Because this program will set the terminal machine back to the original state, in addition to being used in login, when the system terminal enters some strange state because the program is not normally executed, you can also use it to reset the terminal. For example, if you accidentally use cat commands to import binary files to the terminal, some terminals usually do not respond to keyboard input or some strange character problems. In this case, you can use reset to restore the terminal to the original state. Option description:


-P
Display the terminal category on the screen, but do not set the action. This command can be used to obtain the category of the current terminal.
-E ch
Set erase characters to ch
-I ch
Set the delimiter to ch.
-K ch
Set the character of a row to ch.
-I
Do not set the action. If option-Q is not used, the current values of erase, interrupt, and delete characters will still be sent to the screen.
-Q
Do not display the values of erase, interrupt, and delete characters on the screen.
-R
Print the terminal category on the screen.
-S
Send the command used to set the TERM to the terminal in the string type, which is usually used in. login or. profile.
Example:
Let the user enter a terminal type and set the terminal to the preset status of this type.
# Reset?


Set erase characters to control-h
# Reset-e ^ B


Display the set strings on the screen
# Reset-s
Erase is control-B (^ B ).
Kill is control-U (^ U ).
Interrupt is control-C (^ C ).
TERM = xterm;

Name: compress

Permission: All Users


Usage: compress [-dfvcV] [-B maxbits] [file...]


Note:
Compress is a fairly old unix File compression command. After compression, A. Z extension file name will be added to the compressed file to distinguish uncompressed files. The compressed file can be decompressed with uncompress. To Compress several files into one compressed file, you must first tar the file and then compress it. Since gzip can produce a better compression ratio, most people have switched to gzip as the archive compression tool.


Parameters:
C output result to standard output device (usually screen)
F. Write the file forcibly. If the target file already exists, it will be overwritten (force)
V prints program execution messages on the screen (verbose)
B sets the upper limit of the number of common strings. It is calculated in bits and can be set to 9 to 16 bits. Because the larger the value, the more common strings can be used and the larger the compression ratio, the default value 16 bits (bits) is generally used)
D. decompress the compressed file.
V. List version information


Example:


Compress source. dat to source. dat. Z. If source. dat. Z already exists, the content will be overwritten by the compressed file.


Compress-f source. dat


Compress source. dat to source. dat. Z and print the compression ratio.
-V and-f can be used together.


Compress-vf source. dat


After the compressed data is output, import target. dat. Z to change the compressed file name.


Compress-c source. dat> target. dat. Z


-The larger the value of B, the larger the compression ratio. The value range is 9-16 and the default value is 16.


Compress-B 12 source. dat


Decompress source. dat. Z to source. dat. If the file already exists, Press y to overwrite the file. If you use the-df program, the file is automatically overwritten. Because the system automatically adds. Z as the extension file name, source. dat is automatically treated as source. dat. Z.


Compress-d source. dat
Compress-d source. dat. Z

 

Name: lpd

Permission: All Users

Usage: lpd [-l] [# port]
Lpd is a resident printer manager that manages local or remote Printers Based on/etc/printcap content. Each printer defined in/etc/printcap must have a corresponding directory in/var/lpd. Files starting with cf in the directory indicate a print table waiting to be sent to the appropriate device. This file is usually generated by lpr.

Lpr and lpd form a system that can work offline. When you use lpr, the printer does not need to be available immediately or even do not exist. The lpd automatically monitors the printer status. When the printer goes online, the file is immediately sent for processing. All the applications do not have to wait for the printer to finish the previous job.

Parameters:

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.