Linux practical commands
I hope to help you sort out some practical Linux commands.
1. Batch killing process:
Method 1:
Kill-9 'ps-ef | grep java | grep-v grep | awk' {print $2 }''
Method 2:
Ps-ef | grep java | grep-v grep | cut-c 9-15 | xargs kill-9
# Note: here we take killing java processes as an example.
Ii. Search for files:
1) list all empty files with a certain type of file names in the current directory (files with a size of 0 ):
Find.-name "ha_201212 * _ TM_2110015_00_001 * dat"-size 0 | xargs ls-l
2) Find a type of files in the current directory and back up the files to another directory:
Find.-name "ha_201212 * _ TM_2110015_00_001 * dat"-exec cp {}/home/goopand/data_bak/2110015 \;
Iii. Password validity period:
1) view the password validity period and other information:
Chage-l <username>
2) set the maximum password validity period to 90 days:
Chage-M 90 <username>
4. view the current logon User:
(Exclude duplicate user IDs and replace line breaks with commas)
Who | awk '{print $1}' | uniq | sort-u | xargs | tr-s ''','
Note: uniq is not required. The role of uniq: to exclude consecutive repetitions (the repetition of intervals cannot be ruled out ).
10 useful Linux Command Interview Questions and answers
Linux Command cd
Cat for Linux commands
Linux Command alias/unalias
Linux Command Parsing: su root and su-root
Interactive input of Linux commands read
This article permanently updates the link address: