"Linux" saves the terminal's command output as a txt text file

Source: Internet
Author: User

The terminal in Linux is very convenient and can be copied and pasted directly.


Then open a gedit text editor, paste the contents of the copy can be.

Unlike the Windows CMD console, you need to first right-click the title bar, select Edit-All selection/tag, and in the right-click title bar, select Copy, so copy.

CMD is not good, the mouse is not careful, but also may be a mouse shake, painstakingly marked things disappear.


Of course, the above is only the case of Linux graphical interface, if in some pure command line interface, no copy and paste, you need to save a terminal command to a txt text file, you just need to add > Save the location after this command, or >> save the location. Among them, only ">" is to overwrite the existing results, each command result will overwrite the existing TXT file, if you want to save a lot of command results, you need to create a different file name txt file. If you only use a TXT file, to append the cmd command result in the same TXT file, use ">>" to replace ">", this command is also available in Windows CMD, such as input:

[Plain]View PlainCopy
    1. Ping > F:\1.txt

The description of the ping command is output to F:\1.txt, as shown in:


Using the > Output command to run the results, there is absolutely no problem with Linux, but if you use > as above to output command descriptions, such as in Linux, enter:

[Plain]View PlainCopy
    1. Ping > 1.txt

It is not possible to get the command description of the ping, as the result 1.txt is created, but the result is empty, using:

[Plain]View PlainCopy
    1. Cat 1.txt

Printing 1.txt also does not see any characters.


Probably Linux default everyone is a master, no need to explain.

At this point, you can use the script command if you want to get a description of the ping command from Linux.

For example, first use

[Plain]View PlainCopy
    1. Script-a 1.txt


Set all the contents of the next terminal, print to 1.txt this file, and display the results at the terminal. Know what you typed:

[Plain]View PlainCopy
    1. Exit

So far. This prints the text file directly in the graphical gedit open some characters are not normal display, but if the use of

[Plain]View PlainCopy
    1. Cat 1.txt

The discovery is not garbled.

"Linux" saves the terminal's command output as a txt text file

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.