Linux command--echo

Source: Internet
Author: User
Tags what echo word wrap

This is mainly about the echo of a basic use of grammar, echo in the penetration test is also often used, we can use echo in a simple shell to write a word trojan, or through ECHO to the Linux public key written to the remote server as the authentication key, This allows for a password-free login, plus the ability to execute system commands via Echo!

Echo most basic is as output, basic use syntax is as follows:

What echo is going to output
[Email protected]:~/eth10/eth10# echo Hello Eth10hello eth10[email protected]:~/eth10/eth10# echo "Hello eth10" Hello Eth10

But if there are some special characters in the content you want to output, you are likely to be eaten!

[Email protected]:~/eth10/eth10# echo "Hello eth10" Welcome "" Hello Eth10 Welcome

At this point, we can use the-e parameter to turn on escape!

[Email protected]:~/eth10/eth10# echo-e "Hello eth10 \" welcome\ "" Hello eth10 "Welcome" [Email protected]:~/eth10/eth10#

So we can print out special characters! And you can use the escape character \ n to implement line wrapping! But you'd better leave a space before!

[Email protected]:~/eth10/eth10# echo-e "Hello eth10 \n\" welcome\ "" Hello eth10 "Welcome"

In addition, for single quotes, we do not need to add escape characters!

[Email protected]:~/eth10/eth10# echo-e "Hello eth10\n\" welcome\ "' eth10 '" Hello eth10 "Welcome" ' eth10 ' [email protected ]:~/eth10/eth10# echo-e "Hello eth10\n\" welcome\ "\ ' eth10\ '" Hello eth10 "welcome" \ ' eth10\ ' [email protected]:~/eth10/ eth10#

With the simple use of ECHO, only the content can be output, then you can use the redirect > or append >> to write our output to the file!

In addition, we can use the "this symbol to execute system commands via echo, even if there is no word wrap!"

[Email protected]:~/eth10/eth10# echo ' whoami ' Root[email protected]:~/eth10/eth10#[email protected]:~/eth10/eth10# Echo ' cat/etc/passwd ' Root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2: Bin:/bin:/usr/sbin/nologin

Is it possible for us to download any file to the server using wget? or use NC directly to get a reverse connection?

This article is from the "eth10" blog, make sure to keep this source http://eth10.blog.51cto.com/13143704/1958208

Linux command--echo

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.