How can I remove this file? -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered I've tried a few different methods, but most attempts interprets the file name as a switch (which it doesn't understand). TIA, Frank M. Ramaekers Jr. | Systems Programmer | Information Technology | American Income Life Insurance Company | 254-761-6649
On Wed, Apr 02, 2014 at 09:44:57AM -0500, Frank M. Ramaekers wrote:> How can I remove this file? > > -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered > > > > I've tried a few different methods, but most attempts interprets the > file name as a switch (which it doesn't understand).rm -- --backup=numbered -- stops the processing of command line arguments so any file name after will be interpreted literally. John -- "Worry never robs tomorrow of its sorrow, it only saps today of its joy." ~~ Leo Buscaglia -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20140402/6a4ceb97/attachment-0002.sig>
"Frank M. Ramaekers" <FRamaekers at ailife.com> a ?crit?:> How can I remove this file? > > -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numberedrm "--backup=numbered" HTH, Laurent.
rm -f "\--backup=numered" Regards Roberto -----Original Message----- From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Frank M. Ramaekers Sent: mi?rcoles, 02 de abril de 2014 11:45 To: centos at centos.org Subject: [CentOS] Removing a file that starts with dashes How can I remove this file? -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered I've tried a few different methods, but most attempts interprets the file name as a switch (which it doesn't understand). TIA, Frank M. Ramaekers Jr. | Systems Programmer | Information Technology | American Income Life Insurance Company | 254-761-6649 _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos
It is possible. Mask the - by putting a \ or / in front ot it. Or try: rm ./-filename On Wed, Apr 2, 2014 at 9:44 AM, Frank M. Ramaekers <FRamaekers at ailife.com> wrote:> How can I remove this file? > > -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered > > > > I've tried a few different methods, but most attempts interprets the > file name as a switch (which it doesn't understand). > > > > TIA, > > Frank M. Ramaekers Jr. | Systems Programmer | Information Technology | > American Income Life Insurance Company | 254-761-6649 > > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos-- ----------------- Hal Wigoda Chicago
m.roth at 5-cent.us
2014-Apr-02 14:51 UTC
[CentOS] Removing a file that starts with dashes
Frank M. Ramaekers wrote:> How can I remove this file? > > -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered > > I've tried a few different methods, but most attempts interprets the > file name as a switch (which it doesn't understand).Method 1: try rm \-\-backup\=numbered Method 2, that will *ALWAYS* work: ls -i then, using the inode number find . -inum <inode> -exec rm {} \; The latter method is the one guaranteed to take care of all kinds of filenames with weird, or unprintable, stuff in the name. mark
Ahhh...that's the ticket! Frank M. Ramaekers Jr.> -----Original Message----- > From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On > Behalf Of John R. Dennison > Sent: Wednesday, April 02, 2014 9:48 AM > To: centos at centos.org > Subject: Re: [CentOS] Removing a file that starts with dashes > > On Wed, Apr 02, 2014 at 09:44:57AM -0500, Frank M. Ramaekers wrote: > > How can I remove this file? > > > > -rw-r--r-- 1 root root 28707 Mar 31 12:31 --backup=numbered > > > > > > > > I've tried a few different methods, but most attempts interprets the > > file name as a switch (which it doesn't understand). > > rm -- --backup=numbered > > -- stops the processing of command line arguments so any file nameafter will> be interpreted literally. > > > > > John > -- > "Worry never robs tomorrow of its sorrow, it only saps today of itsjoy."> > ~~ Leo Buscaglia