Linux OPS Engineer Pen test 12th set

Source: Internet
Author: User

This set is a shell command, enjoy it~.

1) Suppose that a variable aaa= "Stephen Stephen Chow Chi", now only want to output the following "Stephen Chow Chi", what should be done?

Aaa= "Steven Stephen Chow Chi" Echo ${aaa:3:3}

"Comment on" the total number of known variables and the number of starting characters to be cut, you can use this method to cut the variable. This method is more commonly used in cases where the variable is a long path.


2) Use Curl to get www.163.net response header information

Curl-i http://www.163.net

"comment" Curl-i URL in addition to the site's response header information, there are all the content of the site. If you want to get the content of HTTP status code: CURL-SL-W "%{http_code}\\n" Www.163.net-o/dev/null.


3) No. 505 order in the execution history

! 505

"Comment" The last cat command in the print history is!cat:p, if the last cat command in the execution history is!cat. The last command to perform the previous action is!!。


4) The current time is known as May 16, 2016, and you want to output the date 10 days after the current time, in the form of month and day.

Date +%y%m%d-d 10day

"Comment" If it is the first 10 days, that is the date +%y%m%d-d -10day


5) Repeat the "ps-ef" to observe the real-time situation.

Watch Ps-ef (default time is 2 seconds)


6) Show remaining memory

Free-m |grep Cache|awk '/[0-9]/{print $4 "MB"} '


7) Open the/a/wow.txt and jump to the end of the file

Vim +/a/wow.txt

"Comment" If you want to convert the tab in the article into a space, the command is expand Wow.txt wow2.txt.


8) grep's exact find command

Grep-w

"Review" grep is included in the default search, such as 111.txt has the word "James", #grep "Me" 111.txt, can be found in James, but to find exactly the word me, then you need to use #grep-w "Me" 111.txt.


9) Scan all open 8081-port IPs in the 203.90.146.0/24 network

Nmap-p 8081 203.90.146/24

"Comments" Nmap command is not a Linux comes with, need #yum install-y Nmap installed. Port 8081 is nothing, just a port for testing, and Tomcat defaults to port 8080, this is not a mix.


10) display 1.txt and 2.txt side-by

Paste 1.txt 2.txt

"Comment" This method actually uses very little, because the typesetting effect is very poor, said is side by side, actually two pieces of files are sticky together, very not easy to distinguish, if want better typesetting way, recommend #diff-y 1.txt 2.txt.


11) split large volumes of tar.gz files, each 100MB, and then merge.

Split-b 100m

/path/to/large/archive

/path/to/output/filescat files*>archive


12) Get the owner of the Wow.txt file

Stat-c%u wow.txt

"comment" This thing is more than cut awk, such as cut to cut to more force lattice?


13) Find a file with a space at the end of the file name

Find. -type f-exec egrep-l "+$" {} \;


14) Enter multiline text

Cat >test.txt (Ctrl+d save exit)

This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1774118

Linux OPS Engineer Pen test 12th set

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.