Linux practical commands

Source: Internet
Author: User

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:

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.