Linux instructions (2)

Source: Internet
Author: User
Tags superuser permission
Name top permission: Usage of all users: top [-] [ddelay] [q] [c] [S] [s] [I] [n] [B] description: does the process dynamically display in real time? D: change the display update speed, or press sq in the interactivecommand column: display without any delay

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:

Related Article

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.