How do you delete the contents of a file in Unix?

How do you delete the contents of a file in Unix?
Answer
Deleting files (rm command)
  1. To delete the file named myfile, type the following: rm myfile.
  2. To delete all the files in the mydir directory, one by one, type the following: rm -i mydir/* After each file name displays, type y and press Enter to delete the file. Or to keep the file, just press Enter.
 

Tìm kiếm

Back
Top