LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-11-2004, 03:07 PM   #1
FiveFlat
Member
 
Registered: May 2003
Location: N. California
Distribution: FC3 2.6.9
Posts: 110

Rep: Reputation: 15
bash: /bin/rm: Argument list too long?


Okay, I haven't been keeping up on my housekeeping much lately.

I'm trying to delete all the logs from /var/log/samba/

The list of files is HUGE. Am I going to have to go through at delete small chunks of it a little at a time? or is there a way around this error?
 
Old 08-11-2004, 03:17 PM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
"rm -f /var/log/samba/*" should delete everything in there.

If you want to save some, you can use different forms of globbing...

"rm -f /var/log/samba/*.log.4" will delete any file ending in ".log.4".
"rm -f /var/log/samba/*.log.[23456]" will delete any file ending in ".log.2", or ".log.3", or ".log.4", or ".log.5", or ".log.6".
 
Old 08-11-2004, 03:26 PM   #3
FiveFlat
Member
 
Registered: May 2003
Location: N. California
Distribution: FC3 2.6.9
Posts: 110

Original Poster
Rep: Reputation: 15
I am using the -f option. Oh, this is killing me.
 
Old 08-11-2004, 03:32 PM   #4
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
rm -fvr /var/log/samba
mkdir /var/long/samba

maybe that would work... i know bash can only pass soo many arguments to a program ... i don't know the exact number tho .. but ill guess its the size of an int (as argc in the main function is a int)

anyways good luck
 
Old 08-11-2004, 03:43 PM   #5
FiveFlat
Member
 
Registered: May 2003
Location: N. California
Distribution: FC3 2.6.9
Posts: 110

Original Poster
Rep: Reputation: 15
schweet!

Thanks a bunch SciYro
 
Old 08-11-2004, 11:29 PM   #6
speck
Member
 
Registered: Nov 2001
Location: California
Distribution: Slackware 14.1
Posts: 271

Rep: Reputation: 54
If you just want to delete certain files in a directory, you can do something like:

Code:
for i in /var/log/samba/*.log
do
    rm -fv $i
done
It's quite a bit slower, but it will work.

Speck
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cp lots of files argument list too long dtra Linux - Software 4 07-07-2005 09:14 AM
argument list to long for linux commands supersucker Linux - Newbie 1 05-10-2005 07:36 AM
-bash: /bin/mv: Argument list too long balanagireddy Linux - General 2 07-27-2004 11:19 PM
Argument list too long trutnev Linux - General 3 04-22-2004 04:32 PM
/bin/rm: Argument list too long dragon49 Linux - Software 1 09-02-2003 12:27 PM


All times are GMT -5. The time now is 11:55 PM.

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