Quickly clear text files in linux and clear linux text files

Source: Internet
Author: User

Quickly clear text files in linux and clear linux text files
1. [root @ desktop huage] #:> filename
: Is a placeholder and does not generate any input
 
2. [root @ desktop huage] #> filename
No output is generated.
 
3. [root @ desktop huage] # echo ""> filename
A blank row is displayed. The file size is 1 byte.
 
4. [root @ desktop huage] # echo> filename
A blank row is displayed. The file size is 1 byte.
 
5. [root @ desktop log] # cat/dev/null> filename
File does not produce any output
How does one clear File Content in Linux?

Opened and deleted with vi
Capture cat/dev/null> filename

Linux Command to clear a text file?

# Rm filename.txt; touch filename.txt

---------------

A command? Another thought

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.