How Do I Delete a Text File in Ubuntu Terminal?
Contents

Type the rm command, a space, and then the name of the file you want to delete. If the file is not in the current working directory, provide a path to the file’s location. You can pass more than one filename to rm . Doing so deletes all of the specified files.

How do I delete a text file in Ubuntu?

Command to delete and remove files on Ubuntu Linux

  1. Open the Ubuntu terminal application (bash shell)
  2. Type any one of the following command to delete a file named ubuntu.nixcraft.txt in the current directory.
  3. rm ubuntu.nixcraft.txt. unlink ubuntu.nixcraft.txt.

How do you delete a text file in Linux?

How to Remove Files

  1. To delete a single file, use the rm or unlink command followed by the file name: unlink filename rm filename. …
  2. To delete multiple files at once, use the rm command followed by the file names separated by space. …
  3. Use the rm with the -i option to confirm each file before deleting it: rm -i filename(s)
Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest