Delete Files And Directories In Current Directory

The rm (remove) command is used to delete files and folders in Linux.

Create Example Files

touch devops.txt hr.txt marketing.txt operations.txt procurement.txt sales.txt

Create Example Subdirectories

mkdir devops sales marketing

Show Directory Contents

ls -l
total 12
drwxrwxr-x 2 linux linux 4096 Jul 28 09:05 devops
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 devops.txt
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 hr.txt
drwxrwxr-x 2 linux linux 4096 Jul 28 09:05 marketing
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 marketing.txt
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 operations.txt
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 procurement.txt
drwxrwxr-x 2 linux linux 4096 Jul 28 09:05 sales
-rw-rw-r-- 1 linux linux    0 Jul 28 09:05 sales.txt

Delete All Files And Subdirectories

rm -rf *

Show Directory Contents

ls -l
ls -l
total 0