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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-10-2007, 07:21 AM
|
#1
|
Member
Registered: Jul 2007
Location: Penang , Malaysia.
Distribution: red hat linux
Posts: 133
Rep:
|
at same directory, is it cannot have same name text file and folder name?
Hi, i have confuse with this: i am in folder /test inside there i have make a directory #mkdir folder1 , than inside /test have a directory name "folder1", now i want to create a text file in same location /test #vim folder1 ,but cannot create this text file? is it folder name and text file or what file also cannot have a same name?
i am in /mnt/hda , now nothing is mount to this directory, i have create a file in this directory, but now i just mount the harddisk partition to this directory mount -t ext3 /dev/hdd1 /mnt/hda than the directory /mnt/hda files which i create before i mount the /dev/hdd1 cannot view after i mount /dev/hdd1?
Thank you.
|
|
|
11-10-2007, 07:35 AM
|
#2
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:
|
Quote:
at same directory, is it cannot have same name text file and folder name?
|
That's right.
Code:
# mkdir folder
# vim folder
~
"folder" is a directory
# touch foo
# mkdir foo
mkdir: cannot create directory `foo': File exists
When you think about it, this behavior is quite reasonable. A directory is a file too... how can you have two files with the same name? How will the computer tell them apart?
Note - you should not be creating user-access directories off root like /text. Create them in your home directory (~/text) or off /usr/share ... the directories are organized that way for a reason. ~/documents is equivalent to My Documents... see?
|
|
|
11-10-2007, 07:55 AM
|
#3
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
I have to disagree with Simon Bridge. You may have a folder and a file in the folder with the same name.
Prove it this way: In your home folder ~,
mkdir test
cd test
mkdir folder1
cd folder1
touch folder1
cd ~
ls -R test
test
test/folder1
test/folder1/folder1
|
|
|
11-10-2007, 09:06 AM
|
#4
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:
|
Quote:
You may have a folder and a file in the folder with the same name.
|
I agree, but that's not what he's asking and it is not what I said.
Quote:
i am in folder /test [1] inside there i have make a directory [2] #mkdir folder1 , than inside /test have a directory name [3] "folder1", now i want to create a text file [4] in same location /test #vim folder1 ,but [5] cannot create this text file?
|
... see?
# pwd ...[1]
/test
# mkdir folder1 ...[2]
# ls ...[3]
folder1
# vim folder1 ...[4]
~
"folder1" is a directory ...[5]
Last edited by Simon Bridge; 11-10-2007 at 09:14 AM.
|
|
|
11-10-2007, 09:13 AM
|
#5
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:
|
See the other question:
Quote:
i am in /mnt/hda , now nothing is mount to this directory, i have create a file in this directory, but now i just mount the harddisk partition to this directory mount -t ext3 /dev/hdd1 /mnt/hda than the directory /mnt/hda files which i create before i mount the /dev/hdd1 cannot view after i mount /dev/hdd1?
|
# pwd
/mnt/hda
# touch dummy
# ls
dummy
# mount -t ext3 /dev/hdd1 /mnt/hda
# ls
documents music archive (or whatever is in there, but not dummy)
# umount /mnt/hda
# ls
dummy
This too is the correct behavior. It hasn't overwritten "dummy", all it means is that /mnt/hda is now about a different drive.
|
|
|
11-10-2007, 09:31 AM
|
#6
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
I stand corrected. On re-reading the original post, I see my error. Thanks for correcting me.
|
|
|
11-10-2007, 11:20 AM
|
#7
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:
|
Quote:
I stand corrected. On re-reading the original post, I see my error. Thanks for correcting me.
|
No worries... the English was pretty mangled... now OP chimes in to say you were right all along
|
|
|
All times are GMT -5. The time now is 04:12 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|