Shell interview questions (1) to be continued grep Common commands Regular Expressions 30 minutes getting started tutorial grep Common commands sed commands simple use [command tips] lsxargs command lsof Common commands

Source: Internet
Author: User

Replace file1 with the actual file as follows

1. query the row number of the empty row in file1.Grep-n "^ $" stl_stable_sort.ccRefer:Common grep commands

2. query the rows ending with ABC in file1.Grep-n "^. * ABC $" stl_stable_sort.ccRefer:Regular Expression 30-minute getting started tutorial grep Common commands

3. Print the file1 file 1st to the third line.Sed-N '1, 3' P stl_stable_sort.ccRefer:Sed command for simple use

2. How to forward requests from local port 80 to port 8080. The current host IP address is 192.168.2.1

Iii. crontab

How can I implement/usr/bin/httpd. Sh every two hours from to in March?

Edit the/etc/crontab file

0 6-12/2 *** root/usr/bin/httpd. Sh

4. Write a shell script to transfer files larger than K under the/usr/local/test directory to the/tmp directory.Ls-L | grep ^-| awk '$5> 100000' | awk '{print $8}' | xargs-t-I {} CP {} TestRefer:[Command tips] ls xargs command

Note:{} Can be understood as the previous parameter. Look at the example
Ls a | xargs-I MV {}{}. Bak
-I is the same as-I.

7. How to view the processes occupying port 8080Lsof-I: 8080Refer:Common lsof commands

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.