Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to truncate a file?

Answer:

Assume you have a file named "test.txt", now you want to truncate (remove the content) of the file, you can use:

> test.txt

That's all.

  1. How to escape “-” character at the beginning of filename?
  2. How to easy remove file with strange file name?
  3. How to resume a partially-downloaded file using wget
  4. How to count the number of duplicated lines in a file
  5. Remove directory name from file path

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>