LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 10-21-2008, 10:57 AM   #1
s3ns4i
LQ Newbie
 
Registered: Jul 2008
Location: 127.0.0.1
Distribution: RedHat Enterprise
Posts: 12

Rep: Reputation: 0
simple questions looking for a simple command


I have a directory where I would like to remove all files but not the actual directory itsel. Last time I did this I used the cat command, but for the life of me im unable to remember it. I though it was something like " cat ( directory) < dev/null or something to that matter. If anyones knows the command real quick I would appreciate it.

Thanks,

Sensai
 
Old 10-21-2008, 12:25 PM   #2
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 82
You would do the following:

Code:
cd /your/directory
rm *
You will need to be very careful with this command! You can erase your entire system! You cannot recover anything that you rm!
 
Old 10-21-2008, 12:26 PM   #3
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,554

Rep: Reputation: 182Reputation: 182
rm /directoryname/*

------------------
Steve Stites
 
Old 10-21-2008, 12:31 PM   #4
linux-qa
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Rep: Reputation: 0
Quote:
Originally Posted by s3ns4i View Post
I have a directory where I would like to remove all files but not the actual directory itsel. Sensai
cd /to/directory/
rm -f *

-f will forcefully remove all the files instead of prompting you during deletion of each file. It helps when you have dozens of files.
 
Old 10-21-2008, 12:55 PM   #5
s3ns4i
LQ Newbie
 
Registered: Jul 2008
Location: 127.0.0.1
Distribution: RedHat Enterprise
Posts: 12

Original Poster
Rep: Reputation: 0
thanks guys i knew of the rm -f * but thought there was another way using the cat command. anyway thanks again


sensai
 
  


Reply


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
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
simple linux command questions herve2001 Slackware 5 02-11-2005 07:44 PM
Simple Questions...Hopfully Simple Answers. caps_phisto Linux - General 3 12-21-2004 12:40 PM
problems creating a simple bootable cd to perform a simple task czarherr Linux - Software 1 11-11-2004 05:22 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM


All times are GMT -5. The time now is 11:45 AM.

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