LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-09-2011, 04:27 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 461

Rep: Reputation: 34
Removal of a file with '(x)' in the file name.


Greetings,

Can anyone give me the proper syntax to remove the following file.

the 'rm' command is coming up with an error when I try to delete it due to the '(2)' in the file name.

Thanks.

firefox-8.0.1(2).tar.bz2
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-09-2011, 04:28 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Enclose the filename in quotation marks.
 
Old 12-09-2011, 04:31 PM   #3
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
Use backslash before each parenthesis
Code:
rm /path/filename\(2\)
or enclose filename with path with single quote chars
Code:
rm '/path/filename(2)'
 
1 members found this post helpful.
Old 12-09-2011, 04:40 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Or use tab completion (assuming bash(1)) to do the backslashes for you.

Code:
$ rm /path/filenaTAB
Or write a little utility (something pleasant, like Perl?) to directly unlink it. Careful with that, though.
 
2 members found this post helpful.
Old 12-09-2011, 04:58 PM   #5
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 461

Original Poster
Rep: Reputation: 34
This work just fine...thank you all for your quick reply.
 
  


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
Removal of a corrupt file from an application fs Joel.M.Punchayil Solaris / OpenSolaris 1 06-29-2011 10:19 PM
tar backup scripts and file removal fishy Linux - Software 2 02-16-2008 07:45 AM
Removal of include/linux/config.h file in 2.6.19 kernel /bin/bash Linux - Kernel 4 12-02-2006 03:34 AM
File interrogation/removal script kenwoodgt Linux - Software 3 08-10-2006 12:33 PM
Bin file removal Crippledzero Linux - Newbie 1 09-28-2004 12:40 PM


All times are GMT -5. The time now is 08:23 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration