Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-08-2009, 12:10 AM   #1
Registered: Feb 2009
Posts: 98

Rep: Reputation: 15
how to delete files using rm command

hai to all

i am using fedora 9 with gnome desktop , i am having folder that consist of various files with different extensions ,

if i execute rm -f *.c command then this will delete only files with .c extension .

if i execute rm -f *.html command then this will delete only files with .html extension .
how can i delete all files(not that directory) regardless of their extensions. is there any command ,please tell me

thanks in advance....
Old 06-08-2009, 12:14 AM   #2
Registered: Jun 2009
Distribution: slackware
Posts: 123

Rep: Reputation: 34
rm -f *
Old 06-08-2009, 01:01 AM   #3
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,187

Rep: Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507Reputation: 2507
did you read
rm --help
--- or ---
man rm
Old 06-08-2009, 01:10 AM   #4
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
find . -type f -exec rm {} \;
Removes files in current and subdirectories (but not subdirectories).
Old 06-08-2009, 02:13 AM   #5
Senior Member
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Yes man page would have given you all the answers though. Be aware that using -f option will be dangerous. Use -v option so that you know is happening and where you are executing the command. If you by mistake execute it on / it will delete everything and you will have no os to boot.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not delete files via Nautilus, only via command line leupi Linux - General 3 01-30-2013 02:33 AM
Using find and rm command to delete files over x days old 200mg Linux - Newbie 16 09-03-2008 06:41 PM
how to delete all files in one command for all user packets Linux - Newbie 4 04-16-2007 08:56 PM
Delete Files through Command Window ankz.upadhyay Linux - Newbie 5 03-27-2007 03:17 PM
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 12:09 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration