[Linux] saves the terminal command output as a txt text file, linuxtxt

Source: Internet
Author: User

[Linux] saves the terminal command output as a txt text file, linuxtxt

This is not a problem because the Linux terminal is very convenient and can be copied and pasted directly.


Then open a gedit text editor and paste the copied content.

Unlike the windows cmd console, You need to right-click the title bar, select edit-> select all/Tag, right-click the title bar, select copy, and copy.

Cmd is not good, the mouse is a little careless, but also may shake the mouse, the hard-pressed things will disappear.


Of course, the above is only the case that Linux has a graphical interface. If some command line interfaces are not copied and pasted, you need to save a terminal command to a txt text file, you only need to add> Save location, or> Save location after this command. Only ">" is used to overwrite the existing results. Each Command result overwrites the existing txt file. To save many command results, you need to create a txt file with different file names. If you only use one txt file and want to append the cmd command result to the same txt file, replace ">" with ">, this command is also available in Windows cmd, such:

ping > f:\1.txt
Output the description of the ping command to f: \ 1.txt, as shown in:


Using> output Command run results is definitely okay in Linux, but if you use> to output command instructions like above, for example in Linux, enter:

ping > 1.txt
Which is beyond the control of the pingcommand. For example, the result 1.txt is created, but the result is empty:

cat 1.txt

Print 1.txt without any characters.


By default, you are a master in Linux.

In this case, you can use the script command to explain the ping command in Linux.

For example, use

script -a 1.txt

Set all the content of the connected terminal to the 1.txt file and display the result on the terminal. Know that you entered:

exit
So far. In this way, some characters in the printed text file are directly opened in the graphical gedit and cannot be displayed normally.

cat 1.txt
No garbled characters are found.


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.