Results 1 to 10 of 10

Thread: How do i remove this file using cli...

  1. #1
    Join Date
    Dec 2008
    Location
    London - UK
    Posts
    53

    Default How do i remove this file using cli...

    Hi all - Silly Q, i'v ssh'ed onto my machine at home and noticed the below file in my ~ folder..

    Code:
    -rw-r--r--  1 osuser users 10240 2011-05-16 12:41 –
    I have tried the following command
    Code:
    rm -v "-"
    but get
    Code:
    rm: cannot remove `-': No such file or directory
    as an error.

    Also tried to 'tab' to the file but nothing

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: How do i remove this file using cli...

    is it in the root of your home (which is what you wrote), or root of root?

    looks to me like the file is named 1 and not the ~ you are trying to
    remove..

    any way, do you know why the file is there, and what it is for?

    if not, don't touch it....find out, and then take the right action.

    --
    dd CAVEAT: http://is.gd/bpoMD
    [NNTP via openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10]
    Dual booting with Sluggish Loser7 on Acer Aspire One D255

  3. #3
    Join Date
    Dec 2008
    Location
    London - UK
    Posts
    53

    Default Re: How do i remove this file using cli...

    I think i got it...

    i ran

    Code:
    ls –il
    and got
    Code:
    2621694 -rw-r--r-- 1 osuser users 10240 2011-05-16 12:41 –
    then used the inode number to remove the file

    Code:
    find . -inum 2621694 -exec rm -f '{}' \;
    to remove special character file...

  4. #4
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,317

    Default Re: How do i remove this file using cli...

    On Wed, 01 Jun 2011 16:06:03 +0000, vmohan wrote:

    > Hi all - Silly Q, i'v ssh'ed onto my machine at home and noticed the
    > below file in my ~ folder..
    >
    >
    > Code:
    > --------------------
    > -rw-r--r-- 1 osuser users 10240 2011-05-16 12:41 –
    > --------------------
    >
    >
    > I have tried the following command
    > Code:
    > --------------------
    > rm -v "-"
    > --------------------
    > but get
    > Code:
    > --------------------
    > rm: cannot remove `-': No such file or directory
    > --------------------
    > as an error.
    >
    > Also tried to 'tab' to the file but nothing




    The name looks to be an em dash (not a 'normal' dash). Try using mc or
    some other file browser to delete it.

    Jim
    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,677
    Blog Entries
    3

    Default Re: How do i remove this file using cli...

    I would normally use:
    Code:
    rm ./-
    for that file (or any file whose name begins with "-".

    However, I just tested, and any of the following seem to work:
    Code:
    rm -
    rm -f -
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  6. #6
    Join Date
    Dec 2008
    Location
    London - UK
    Posts
    53

    Default Re: How do i remove this file using cli...

    Quote Originally Posted by DenverD View Post
    is it in the root of your home (which is what you wrote), or root of root?

    looks to me like the file is named 1 and not the ~ you are trying to
    remove..

    any way, do you know why the file is there, and what it is for?

    if not, don't touch it....find out, and then take the right action.

    --
    dd CAVEAT: C A V E A T
    [NNTP via openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10]
    Dual booting with Sluggish Loser7 on Acer Aspire One D255
    @ DenverD - The file was in my home, non root, folder. The file is not a '1' but a '-', a Special character file. It must of got created when i was testing a bash script...

    @ nrickert - I tried your method, bar the -f switch, which would not work - so tried the inode method which worked...

    Thanks,

  7. #7
    Join Date
    Dec 2008
    Location
    London - UK
    Posts
    53

    Default Re: How do i remove this file using cli...

    thanks hendersj - i shall try mc next time..

    p.s. never heard if an 'em dash' lol

  8. #8
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,317

    Default Re: How do i remove this file using cli...

    On Wed, 01 Jun 2011 18:06:03 +0000, vmohan wrote:

    > thanks hendersj - i shall try mc next time..
    >
    > p.s. never heard if an 'em dash' lol


    "em sash" is a typographic term, it is a "long dash" intended to indicate
    a longer pause.

    Jim
    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,801

    Default Re: How do i remove this file using cli...

    I just tried by creating a file with the ASCII minus sign as a name:
    Code:
    henk@boven:~/test> l
    totaal 8
    drwxr-xr-x  2 henk wij 4096  1 jun 20:29 ./
    drwxr-xr-x 79 henk wij 4096  1 jun 20:29 ../
    henk@boven:~/test> echo "" >-
    henk@boven:~/test> l
    totaal 12
    -rw-r--r--  1 henk wij    1  1 jun 20:29 -
    drwxr-xr-x  2 henk wij 4096  1 jun 20:29 ./
    drwxr-xr-x 79 henk wij 4096  1 jun 20:29 ../
    henk@boven:~/test> rm -
    henk@boven:~/test> l
    totaal 8
    drwxr-xr-x  2 henk wij 4096  1 jun 20:29 ./
    drwxr-xr-x 79 henk wij 4096  1 jun 20:29 ../
    henk@boven:~/test>
    It shows that deleting such a file is trivial. It could thus be that the name:
    . is another Unicode character that looks like the ASCII -. IMHO one can remove this in a terminal emulator by copy/past of the name in the rm command.
    . contain other characters that show no glyph on the screen. This can be detected by using ls -b.
    Henk van Velden

  10. #10
    Join Date
    Dec 2008
    Location
    London - UK
    Posts
    53

    Default Re: How do i remove this file using cli...

    Thanks Jim & hcvv - much appreciated chaps..

    vj

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •