A Beginner Guide to Delete Files and Directories on Ubuntu Using rm Command

By | January 2, 2020

Delete files and directories are common operations on ubuntu. In this tutorial, we will introdue how to delete them for ubuntu beginners.

Delete Files and Directories on Ubuntu Using rm Command

How to delete files and directories on ubuntu?

The simplest way is to use rm command.

How to use rm command

rm command likes:

 rm -option files_or_directories

option can be:

-d or –directory delete a directory
-f or –force force to delete a file or directory
-i or –interactive delete file or directory with a interactive way
-r or -R or –recursive delete files and directories recursively

For example:

Delete a file

rm -f 1.cpp

Delete all files and subdirectories in a directory

rm -rf code

Leave a Reply

Your email address will not be published. Required fields are marked *