LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-11-2009, 03:53 PM   #1
RileyTheWiley
Member
 
Registered: Dec 2007
Posts: 59

Rep: Reputation: 15
Question Two files with the same name in the same directory?


I am running fedora and recently interrupted an installation of some software. I restarted the install and noticed that I have two subdirectories under /tmp that appear to have identical names. I am able to rm one of them but one always persists. I cannot cd into it or remove it. I can create another directory with exactly the same name in that directory.

What's going on? How do I get rid of it?

Thanks

Riley
 
Old 01-11-2009, 04:00 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You are correct, they merely
Quote:
appear to have identical names
You cannot have two files or directories in the same folder with the same name.

Your best bet is to delete with wildcard.

For example, "rm -f /tmp/*xyz*" will delete file/directory "xyz" and " xyz" and "xyz " and "xyz\r\n".

'Hope that helps .. PSM
 
Old 01-11-2009, 04:03 PM   #3
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Rep: Reputation: 16
The /tmp directory is a temporary directory. The filesystem and programs and applications use that directory. You can get information about the ownership of the directories and files with the command ls:

> man ls
> ls -l /tmp

You probably do not have the right permissions to remove the file, or the directory. In the case of a directory, it probably is not empty so can not be removed by an "rm" without the recursive option.

> man rm
 
Old 01-11-2009, 04:40 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
A way to find out if a filename contains some weird character which is not visible on the terminal is to pass the output of ls to the od command. Restrict the output of ls using wildcards, for example if the "apparently" identical subdirectories are called "testdir", just issue
Code:
ls -d *testdir* | od -c
And please, post the output here (you know... we are curious)!

Last edited by colucix; 01-11-2009 at 04:41 PM.
 
Old 01-12-2009, 05:21 AM   #5
osamaensyviswinkel
LQ Newbie
 
Registered: Sep 2007
Location: Stellenbosch, South Africa
Distribution: Ubuntu 12.10 at home, Mac OS X on laptop
Posts: 20

Rep: Reputation: 0
Are you sure they are the same? Or they don't start for example with ~ ?
Give a ls -alh output here.

Thanks
 
  


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
How to copy files after search in array from this directory to another directory! phanvinhgiap Programming 4 01-04-2009 06:48 PM
Count the number of files in a directory and sub-directories within that directory soumyajit.haldar Linux - Software 4 03-20-2007 06:22 AM
Autozipping files from 1 directory & dropping them in other directory ??? amitsharma_26 Linux - Networking 5 10-22-2005 06:09 AM
copy files from directory to directory without subfile ALInux Linux - General 2 06-03-2005 11:51 AM
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 10:55 PM


All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration