Objective
This article summarizes the actual development of their own regular use of commands, not regularly updated to facilitate their own and other people to consult.
If there are other use techniques to improve efficiency. Welcome message.
This address http://blog.csdn.net/never_cxb/article/details/47803991 reprint please indicate the source
Linux often uses commands basic
cd -Go back to the last working folder
export LANG=en_US, export settings for environment variables can also be used for child shells
ps -ef | grep nginxSearch. There's a pipe in here.
passwd rootChange Password
topMonitor CPU memory, etc.
$?The exit status of the last command run. Success is 0, unsuccessful is not 0
hostnameGet IP
LS frequently used in the number of parameters
-aList all (including hidden files, etc.):
-ltrAccording to the time ascending
-ltAccording to the time descending
Number of statistical files
wc -lNumber of output file lines, i.e. number of files
Ability to grep filter files by
[Root@** _posts]#ls-ltotal156-rw-r--r--1Root root13607The - -: -android-interview.md-rw-r--r--1Root root16287The - -: -arrays-Sort. md-rw-r--r--1Root root2951The - A:GenevaCommon-tools.md[root@** _posts]#ls| Wc-l3[Root@** _posts]#ls| Grep". MD"| Wc-l3
Find Files
locate
Locate is based on the internal system table, fast, but may not update immediately
find . -name "*.sh" -or -name "*.c"
Find instant lookup with relatively slow speed
Port Usage # #
netstat -tnpl | grep 12
kill -9 42312Kill the process,-9 means force kill
Sed use
There are many ways to use it.
‘$d‘ datafile#删除最后一行,其余的都被显示‘/my/d‘ datafile#删除包括my的行,其余的都被显示
Common ways to use the shell
$#Indicates the number of parameters received
$1Indicates the first few parameters
if [ $# -ne 4 ] Then echo "Usage:bash autofetch.sh <space > <windows/linux> <command> <number> " exit -1 fi which=$1 Span class= "Hljs-keyword" >if [$2 = "Windows" ]then machine=windowselif [$2 = "Linux" ]then Machine=linuxfi
Vim is often moved using the command direction
h, j, k, lMove left, bottom, top, right, respectively
Add a number to these J-numbers, indicating the multiple of the move. For example, "10j" means moving down 10 rows
^Move the cursor to the beginning of the line 0 (number 0) can also achieve the same function
^ is the first non-whitespace character to move to the beginning of the first line
0 just move to the beginning of the line without distinguishing between whitespace or non-whitespace
$Move cursor to end of line
ggBack to the beginning of H the file and back to the top of the file
Gto the following
Copy and paste
ddDelete, preceded by a number indicating how many rows were deleted, for example 100DD
dwDelete a word
d$Delete the word to the end of this line
yyCopy
pPaste
They all have the ability to add numbers to indicate how many lines of operation
Enter text
Find replacements
/stringFind
nFind the next matching
:set nuShow line Numbers
Save
:wqWrite and exit
:q!Force quit do not save changes
Online learning
Recommend an online learning vim site http://www.atool.org/vim.php
References
http://easwy.com/blog/archives/advanced-vim-skills-basic-move-method/
Linux Shell Vim often uses commands, usage tips to summarize