File with no name


 
Thread Tools Search this Thread
Operating Systems Solaris File with no name
# 1  
Old 11-23-2005
Question File with no name

Hi Guys,

I have a file in my home directory with no name. Now how did it get created and how can i know what type is it? and how can I open it?

I am using the following server
SunOS 5.8 Generic_108528-29 sun4u sparc SUNW,Ultra-250.

ls -lrt in the directory gives the following ouptut alongwith the other files

-rw-r--r-- 1 rathodr users 99431 Oct 31 11:45

I found it weird that there was no filename.

I tried doing some counting as follows
ls -lrt | wc -l
77
ls -1 | wc -l
76

Think, this file is displayed only in ls -lrt and not in ls -1

Has somebody come across something like this before.
Although this is not causing any probelms for me, I am very curious to know the reason.

Thanks,
Rahul.
# 2  
Old 11-23-2005
try use ls -i then u can rename it by inode #

# ls -ail
208978 drwxr-xr-x 1 2430 Aug 3 13:08

# find . -inum 208946 -exec mv {} newname \;
# 3  
Old 11-23-2005
I dont think you can have a file with no name. It should have something to point to even if it is a space.

Look at this demo.

Code:
touch \

Note, there is a whitespace after the \

ls -l gave me

Code:
-rw-rw-r--    1 xxxx xxxx        0 Nov 23 00:33

If you open it with vi, at the bottom of the vi screen, you can see

Code:
" " 0L, 0C

If you actually put some data, save and then do an ls -l.

Code:
-rw-rw-r--    1 xxxx xxxx       17 Nov 23 00:36

So there is some file whose name starts with a whitespace.
# 4  
Old 11-23-2005
If it is a file that is called ' ', i.e. a single space, you can delete it a couple of ways....

Code:
$ touch \
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:26
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ rm ' '
$ ls -la
total 4
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ touch \
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:26
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ ls -lia
total 4
       320 -rw-rw-r--   1 foo    bar            0 Nov 24 11:26
       319 drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
         6 drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ find . -inum 320 -exec rm {} \;
$ ls -la
total 4
drwxrwxr-x   2 foo   bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo   bar         1024 Nov 24 11:25 ..

Also, it might actually be some kind of control character... observe...
Code:
$ touch ^G
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:27
drwxrwxr-x   2 foo    bar          512 Nov 24 11:27 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ ls -lba
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:27 \007
drwxrwxr-x   2 foo    bar          512 Nov 24 11:27 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..

Cheers
ZB
# 5  
Old 11-27-2005
Thanks

Thanks all for your explanations.

Regards,
Rahul Rathod.
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies
Login or Register to Ask a Question