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


  Search this Thread
Old 04-16-2005, 12:23 AM   #1
Registered: Apr 2005
Distribution: OpenBSD 4.6
Posts: 54

Rep: Reputation: 15
Editing a directory?

I had accidentally opened a directory in vi, and it has a list of directories and stuff... that totally freaked me out... so what's going on? *nix systems does treat EVERYTHING as a file I guess?
Old 04-16-2005, 01:17 AM   #2
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
a directory is basically a collection of pointers to files. Its really file system dependent, and has nothing to do with *nix

if you pass a directory to vi, it will not edit it, but display what files there are, and let you pick what file to edit.
Old 04-16-2005, 01:43 AM   #3
Senior Member
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Originally posted by SciYro
if you pass a directory to vi, it will not edit it, but display what files there are, and let you pick what file to edit.
If you pass a directory to vim it will display the files and allow you to pick one to edit. If you pass a directory to vi, it opens it as a read-only file and displays the contents.

It is impossible to "edit" a directory, per say. All editing must come through the system calls (unlink(2) and all those). Now, this is not true in very odd and particular circumstances (aka, you need to work very hard at it -- unmounting a disk and reading the whole thing as a file would be one way to circumvent this... but there is no "good" reason to do this).


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
Fedora Directory Server sync Active Directory paul_mat Linux - Networking 8 03-08-2007 10:51 AM
Autozipping files from 1 directory & dropping them in other directory ??? amitsharma_26 Linux - Networking 5 10-22-2005 06:09 AM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 10:55 PM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 03:04 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:09 AM.

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