You are not logged in.

#1 2015-07-31 15:58:59

ali_archi
Member
From: Sunny Sheffield
Registered: 2013-03-01
Posts: 8

I have a strange -# file in my home dir, and I can't read of it

The file name is -#, and I can't access

[root@mimas alex]# ls -lA
-rw-r--r-- 1 root root  454 Jul 28 22:19 -#
-rw------- 1 alex alex 5935 Jul 30 23:14 .bash_history
-rw-r--r-- 1 alex alex   21 Jun  4  2013 .bash_logout
-rw-r--r-- 1 alex alex   57 Jun  4  2013 .bash_profile
-rw-r--r-- 1 alex alex  141 Jun  4  2013 .bashrc
drwxr-xr-x 2 alex alex 4096 Jul 29 12:00 .ssh
drwxr-xr-x 2 alex alex 4096 Jul 21 08:00 tmp_mnt
-rw------- 1 alex alex  922 Jul 29 13:58 .viminfo
[root@mimas alex]# less -#
Value is required after -# (--shift)
[root@mimas alex]# less /-# 
/-#: No such file or directory
[root@mimas alex]# less \-# 
Value is required after -# (--shift)
[root@mimas alex]# vi -# 
vi: illegal option -- #
Usage: vi [- | -s] [-l] [-L] [-R] [-r [file]] [-t tag]
       [-v] [-V] [-w size] [+cmd | -c cmd] file...
[root@mimas alex]# vi \-# 
vi: illegal option -- #
Usage: vi [- | -s] [-l] [-L] [-R] [-r [file]] [-t tag]
       [-v] [-V] [-w size] [+cmd | -c cmd] file...
[root@mimas alex]# 

Can anyone please reassure that it is OK to

 #rm ./-# 

? Thanks.


_________________________________________________________________
"The journey is the reward"
SJ

Offline

#2 2015-07-31 16:09:58

betseg
Member
From: Turkey
Registered: 2015-04-25
Posts: 182

Re: I have a strange -# file in my home dir, and I can't read of it

less "./-#" 

Maybe?

Offline

#3 2015-07-31 16:25:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,803

Re: I have a strange -# file in my home dir, and I can't read of it

That was an interesting experiment:

ewaller@turing ~/tmp [1]1023 %touch '-#'
touch: invalid option -- '#'
Try 'touch --help' for more information.
ewaller@turing ~/tmp [1]1024 %touch ./-#
zsh: no matches found: ./-#
ewaller@turing ~/tmp [1]1025 %touch ./\-\#
ewaller@turing ~/tmp 1026 %ll
total 0
-rw-r--r-- 1 ewaller ewaller 0 Jul 31 09:23 -#
ewaller@turing ~/tmp 1027 %rm ./\-\#
ewaller@turing ~/tmp 1028 %ll
total 0
ewaller@turing ~/tmp 1029 %

Last edited by ewaller (2015-07-31 16:25:50)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2015-07-31 16:25:23

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: I have a strange -# file in my home dir, and I can't read of it

To access it use 'cat -- -#', 'less -- -#', etc. The problem is that without '--' the programs are trying to treat the filename as a flag. '--' is common to many programs and indicates there are no more flags after it, so anything that comes next is not treated as a flag even if it looks like a flag. tongue

You should also figure out what's causing the file to be created. Hopefully getting a look inside it will help with that.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2015-07-31 20:02:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: I have a strange -# file in my home dir, and I can't read of it

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2015-07-31 20:17:00

ali_archi
Member
From: Sunny Sheffield
Registered: 2013-03-01
Posts: 8

Re: I have a strange -# file in my home dir, and I can't read of it

alphaniner wrote:

To access it use 'cat -- -#', 'less -- -#', etc. The problem is that without '--' the programs are trying to treat the filename as a flag. '--' is common to many programs and indicates there are no more flags after it, so anything that comes next is not treated as a flag even if it looks like a flag. tongue

You should also figure out what's causing the file to be created. Hopefully getting a look inside it will help with that.


Thanks for the tip! This worked, and here is the result:

[alex@mimas ~]$ cat -- -#
<html>
  <head><title>Found</title></head>
  <body>
    <h1>Found</h1>
    <p>The resource was found at <a href="https://dl.dropboxusercontent.com/u/###### info voluntary removed #########">https://dl.dropboxusercontent.com/u/###### info voluntary removed #########</a>;
you should be redirected automatically.

<!--  --></p>
    <hr noshade>
    <div align="right">WSGI Server</div>
  </body>
</html>

Upon seeing this, I remembered that I used curl (for the first time) to download some pictures that were in my dropbox public folder.

Interesting, isn't it ?


_________________________________________________________________
"The journey is the reward"
SJ

Offline

Board footer

Powered by FluxBB