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 12-09-2011, 05:27 PM   #1
Registered: Sep 2005
Location: New Jersey, USA
Distribution: Centos 7 , Linux Mint 18.1 Under VMware in Win7
Posts: 548

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


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.


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

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

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Use backslash before each parenthesis
rm /path/filename\(2\)
or enclose filename with path with single quote chars
rm '/path/filename(2)'
1 members found this post helpful.
Old 12-09-2011, 05:40 PM   #4
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.

$ 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, 05:58 PM   #5
Registered: Sep 2005
Location: New Jersey, USA
Distribution: Centos 7 , Linux Mint 18.1 Under VMware in Win7
Posts: 548

Original Poster
Rep: Reputation: 34
This work just fine...thank you all for your quick 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 11:19 PM
tar backup scripts and file removal fishy Linux - Software 2 02-16-2008 08:45 AM
Removal of include/linux/config.h file in 2.6.19 kernel /bin/bash Linux - Kernel 4 12-02-2006 04:34 AM
File interrogation/removal script kenwoodgt Linux - Software 3 08-10-2006 01:33 PM
Bin file removal Crippledzero Linux - Newbie 1 09-28-2004 01:40 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:13 AM.

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
Open Source Consulting | Domain Registration