Linux Basics

21 / 107

Delete a file

To delete a file you can use rm command like:

rm file_name(s)

For deleting directories we have to use -r option with the command.

Also, to delete all files of a particular extension, we can replace file_name with *extension. So, to delete all txt files in a directory, we can use rm *.txt

  • Type cd ~ command to go to your home directory
  • Delete the directory z/y/x created in the previous question.

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...