Linux basic commands Collation (iii): Process and Vim

Source: Internet
Author: User
Tags memory usage iptables


Linux Basic command Finishing (iii)
-----------Process and Vim
First, the process
1. View the process
PS: Intercepts the state of the program running at a point in time
A: All the processes
X: Background process
U: Effective user-related processes (common combination aux)
-ia: can also observe all the data of the system
AXJF: Together with part of the program Tree State
-I: Check out your bash-related programs today
Top: Changes in the dynamic observation process
-D: The following description is the time of the entire page refresh; default is 5 seconds
-B: Perform the top in batch mode
-N: Used in conjunction with-B, meaning that a few top output results are required
Example: Top-b-N 2
-P: Specify a PID for observation
Instructions for keys that can be used during the execution of top
? : Displays key commands that can be entered in the top
P: Sort CPU-useful resources
M: Sort the resources used in memory
N: Sort by PID
T: The cumulative sort of CPU time used by the process
K: Kill the process after giving a PID
R: Give a certain PID a nice value to re-establish
Q: Keys to leave the top software
Pstree: Viewing the process tree
-A: Link between process trees in ASCII characters
-U: The Code of the program tree has been concatenated with the characters of the universal character
-P: Simultaneously lists the PID for each process
-U: Also lists the account name of each process
Common Combination Pstree-aup
2. Management of processes

Klii send signal (not just kill process)
-L (lowercase in L): Lists the signals that are currently available for kill
-15: Terminate a process in normal program mode
-9: Force a process to terminate immediately
-2: Exit
-1: If the daemon is reloaded, the process will be terminated if it is not a daemon
Killall-signal: Forces all processes that start with a command name to be terminated
Second, the system resources monitoring
Free: Observe memory usage
-B: The units displayed when you enter free directly are Kbytes, and we can use B (bytes), M (Mbytes), K (Kbytes), and G (GBytes) to define the display units
-T: Displays the total amount of physical memory and swap in the output result
Uname: Access to information about the system and its core
-A: All system related information, including the following data will be listed
-S: The name of the system kernel
-R: Kernel version
-M: Hardware name of the system
Types of-P:CPU
-I: Hardware platform

Uptime: Observing the startup time and workload of the system
Netstat: Network monitoring
-A: List all the connected, listening, and socket data on the system
-T: Listing information for TCP network packets
-U: Lists information for UDP network packets
-N: Display in port mode
-L: Lists the services currently being monitored
-P: Lists the process ID of the network service
Vmstat: Detecting changes in system resources CPU, memory, disk IO
-A: Use Inactive/active (active or not) to replace buffer/cache memory output information;
-F: The number of System replication (fork) processes so far;
-S: A description of the list of memory changes caused by some events (booting up to date);
-S: Can be followed by units, so that the displayed data has units. For example, k/m replaces bytes capacity;
-D: Lists the total read and write statistics for the disk
-P: The disk partition is listed later, which shows the total read and write statistics of the disk partition
Firewall startup, Status View, shutdown
Service Iptables Start
Service iptables Status View
Service Iptables Stop Stop
Service Iptables Restart Restart
Permanently closed:
Chkconfig iptables off
Permanently open:
Chkconfig iptables on
Task management:
&amp: Directly put the command in the background to execute
Job: View the current work status
-L: List details
-R: List tasks in background run
-S: Lists tasks that are paused in the background
fg+ Task Number: Transfer background tasks to the foreground for example: FG 2
bg+ Task number: Programming the background program to perform state such as: BG 2
Nuhup: Perform tasks after offline and logoff
Nuhup tail-f Install.log
Third, vim command
Shortcut keys for general mode
h or the cursor moves left one character. If 20h, moves the left 20 characters.
J or move the cursor down one character ibid.
K or move the cursor up one character ibid.
L or move the cursor right one character above
[ctrl]+[f] screen moves down one page
[Ctrl]+[b] Screen move up one page
0 or [Home] moves to the front character of this line
$ or [end] moves to the end of the line where the cursor is located

General mode shortcut keys
H cursor moves to the first character of the top row of the current screen
M cursor moves to the first character of the line in the middle of the current screen
L cursor moves to the bottom line of the current screen first character
G Move to the last line of this file
Ng moves to nth row
GG equivalent to 1G, that is, move to the first line
N[enter] Cursor moves down n rows
/word down to find the word "word"
? Word looks up the word "word"
n means repeating the previous find operation
n is opposite to n (Reverse lookup)

General mode shortcut keys (replace)
: s/word1/word2/g Word1 replaced with Word2 in the current row
:%s/word1/word2/g replaces word1 with Word2 in current file
: N1,n2s/word1/word2/g in N1 to N2 row find Word1 Replace with Word2 (N1, N2 as number)
: 1,$ s/word1/word2/g from first line to last line find Word1 replace with Word2
: 1,$ s/word1/word2/gc Ibid, confirm replace before replacement

General mode shortcut keys (delete)
X Remove one character backwards
NX removes n characters backwards (n is a number)
X Delete one character forward
DD deletes the cursor in the row
NDD delete the row following n rows (n is a number, including the current row)
D1G Delete all data (including rows) from the row of the cursor to the first row
DG deletes the line from the cursor to the last row
d$ Delete the last character of the cursor to the same peer
D0 deletes the cursor to the first character of the peer.

General mode shortcut keys
YY the copy cursor is in the row
NYY copy cursor down n rows (n is number)
Y1G copy cursor line to first row all data
YG copies all data from the row to the last row of the cursor
y$ copy cursor to the last character of the same peer
y0 copy cursor to the first character of the peer
P Pastes the copied data to the next line of the cursor
P Pastes the copied data to the top row of the cursor
U undo previous action (similar to CTRL + Z in Windows)

Edit mode shortcut keys
Conversion of General mode > Edit mode
I insert from where the cursor is located
I insert from the first non-blank character of the row prompt
A prompt insert from the next character in the cursor
A prompt inserted from the last word in the line where the cursor is located
o Insert a new line at the next line where the cursor is located
o Insert a new line at the cursor location
R replaces the character at the cursor one time
R always replaces the text at the cursor until ESC is pressed

Command mode shortcut keys
: w [filename] Save as filename
: R [FileName] reads the contents of the filename specified in the file to the line where the cursor is located.
: n1,n2 w [filename] save N1 to N2 row as filename
:! command to execute the commands in a temporary switch-to-line mode.
such as ":!ls/home" can be in vim to view the file information under/home with LS output.
: Wq left after saving
: q! Do not save leave
: Set NU Displays line number
: Set Nonu suppress line numbers

Linux basic commands Collation (iii): Process and Vim

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.