6
votes
1answer
92 views

Why are rmdir and unlink two separate system calls?

Here's something that kept me wondering for a while: [15:40:50][/tmp]$ mkdir a [15:40:52][/tmp]$ strace rmdir a execve("/usr/bin/rmdir", ["rmdir", "a"], [/* 78 vars */]) = 0 brk(0) ...
2
votes
1answer
153 views

inotifywait not working when folder is deleted and re-created

I am trying to use inotifywait to monitor a folder: inotifywait -m -r /home/oshiro/Desktop/work_folder The command works and if I create files in that folder, all seems to work correctly. While ...
3
votes
3answers
258 views

Transform a directory into file or a file into directory

I wanted to create a file named test. Accidentally I run mkdir test instead of touch test. Is it possible to convert test directory in a file named test? What about converting a file named test into ...
4
votes
2answers
419 views

Where is a shell script run from?

I have a shell script in /usr/bin. Let's call it hello. It contains this: echo "I am located in $PWD" echo "I am called from this directory: ???" Running hello from /home/Documents I expect the ...
2
votes
2answers
34 views

Specialized access control for directories in RedHat

I have a requirement where I want to change permissions for a directory so that the directory owner (user/group) would be able to create files inside the directory and modify them, but won't be able ...
3
votes
3answers
2k views

How to determine how many files are within a directory without counting?

I've been having a fairly serious issue on a high traffic web server. PHP pages are slowing down considerably, and it only seems to be an issue on pages where sessions are accessed, or a certain table ...
1
vote
3answers
78 views

Mode to set Directory in Only READ-WRITE mode

Can anyone tell me how to set a directory only in read/write mode as below? -rw-rw-r-- I tried with 640,644 but I am able to achieve...
3
votes
2answers
125 views

How to make directory modication date change when files from that dir change?

For example, if a file has been changed in that directory, then directory modification date should be updated. Basically any changes that happen in that directory should trigger a "touch" on the ...
2
votes
2answers
629 views

Prevent creating directories but allow creating files

I have a directory shared through Samba. I want users to be able to create/modify/delete files but not create/erase directories. I haven't found a way to do it. Maybe with SELinux? But how?
3
votes
1answer
100 views

How can I delete a hardlink to a directory?

Before I get 100s of answers that tell me it is impossible to hardlink directories in linux: yes, I know that. The file in question appeared in lost+fount after I checked the filesystem with e2fsck ...
1
vote
1answer
439 views

How do I manually modify an inode?

I am using Ubuntu Linux and, just for fun, I want to create a hardlink to a directory (as seen here). Because I'm just doing this for fun, I'm not looking for any sort of pre-developed ...
1
vote
2answers
1k views

Why can I only run a .sh file from the parent directory, not the child directory

I am a Linux noob. I noticed that this does not work: /tomcatDirectory/bin $ startup.sh //command not found but this does work /tomcatDirectory $ bin/startup.sh I am used to Windows. It seems ...
1
vote
2answers
685 views

How can be monitored I/O stream in a particular Linux directory or file?

I have a problem with monitoring of i/o stream in the particular directory(amount of read and written bytes during specified period). I have been trying to use iostat, inotifywait and inotifywatch, ...
5
votes
3answers
972 views

What are the advantages of the Unix file system structure

If I install an application in Linux for example Debian/Gnu Linux, the files of the applications are copied to many different directories in the file system. Some scripts goes into /usr/share .. ...
1
vote
1answer
126 views

How to change the current directory graphically using the keyboard only?

There was a program named NCD (Norton Change Directory) a few years ago that did a good job at helping me change directory back in the DOS days. This programs displayed a tree, and you could navigate ...
1
vote
1answer
157 views

What does - mean with association to Linux files and directories [duplicate]

Possible Duplicate: What does “--” (double-dash) mean? What does '--' (two dashes) mean with association to Linux files and directories. I've found something else but not too sure if it is ...
16
votes
3answers
3k views

When should I use a trailing slash on a directory? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Most commands I use in linux behave exactly the same whether I include the trailing slash / ...
11
votes
1answer
205 views

How to log all the events performed on directory?

How can I log all the events performed on a particular directory? I want to log the entry of each directory modified within some time duration. I am using find . -type d -mmin -5 command. In ...
3
votes
1answer
292 views

How does the Linux file structure work?

I see the different folders bin, dev, mnt, proc, srv, sys, etc. What are the properties of all these different folders? What are there purposes? Are there files in some of them that I should not ...
1
vote
1answer
118 views

Linking “..” do somewhere other than parent directory and other strange fs beharviors

Can the entry ".." become linked to someplace other than the parent directory? Is it possible to cause "tar" to create this weird behavior? Scenario: I have a pre-built compiler to a embeded system, ...
12
votes
4answers
1k views

Best method to collect a random sample from a collection of files

Suppose there is a directory holding 300 data files. I want to randomly select 200 of those files and move them into another directory. Is there a way to do that under Unix/Linux?
0
votes
2answers
1k views

How to calculate in linux number of file inside nested directories?

I need to extract information how much files are in some directory tree: /.../testRoot/test1/test11/..../file1 /.../testRoot/test1/test11/file2 /.../testRoot/test1/test11/..../file3 ...
0
votes
3answers
2k views

Options for .hidden files?

What options exist for the .hidden file? I wanted to hide certain filetypes in a folder, but simply putting *.out, which I assumed would hide all files ending in .out, didn't work. :( I'm using ...
2
votes
2answers
3k views

How can I selectively copy files from one directory to another directory?

On Linux, how do I selectively copy most – but not all – files from a directory (dir1) to another directory (dir2)? I do not want to copy *.c and *.txt files to dir2. The cp man page ...
3
votes
4answers
1k views

Accidental deletion of /lib directory in Fedora 15

I accidentally deleted the /lib directory on my Fedora 15 machine and I'm not sure how to go about fixing this. Any help in figuring out how to restore the directory along with symbolic links would be ...
0
votes
0answers
58 views

How can I log who creates a directory? [duplicate]

Possible Duplicate: Is it possible to find out what program or script created a given file? Is it possible to log which process/user/IP created a directory? I only found out that the ...
2
votes
2answers
1k views

Directory/files owned by a non-existent user

A user has created a directory with files, but the user does not exist in /etc/passwd or /etc/group. The system is a Fedora server with an FTP server and proxy which redirects to a CentOS server with ...
86
votes
3answers
30k views

Why do directories need the executable (X) permission to be opened?

In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory?
3
votes
1answer
905 views

Prevent a subdirectory from getting deleted / enforce a directory structure

imagine the following folder structure ../documents ../documents/templates I have two user groups: editors managers Users of both groups should be able to create new files modify any ...
4
votes
2answers
2k views

Using vim to view the contents of a directory file

As I understand, in Linux directories are mostly normal files w/ some special handling (e.g. 'rm' a file is ok; 'rm' a dir will complain w/o -r). When I execute the following bash commands: mkdir ...
5
votes
2answers
71 views

Making a duplicate of a path in Unix

My Unix vocabulary is failing me. I have 5 billion images in /foo/live/images. For the purposes of developing a new version of the app I'd like to make /foo/dev/images into a working path without ...
3
votes
2answers
990 views

How many files can be saved in one directory on Linux? [duplicate]

Possible Duplicate: Number of files per directory I need to save 1 milion static html files in one directory as there is not possible to group the files into the directories (all files must ...
8
votes
6answers
26k views

How to remove all the files in a directory?

I am trying to remove all files and subdirectories in a directory. I used rm -r to remove all files, but I want to remove all files and subdirectories, excluding the top directory itself. For ...
18
votes
6answers
4k views

What's the most “correct” mount point for a permanent NTFS partition?

I have an NTFS partition (containing a Windows installation from which I dual boot) that I would like to permanently mount from my Linux installation. Problem is, I can't figure out what the ...
34
votes
5answers
16k views

Difference between /bin and /usr/bin

I read this up on this website and it doesn't make sense. http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/basic/node32.html When UNIX was first written, /bin and /usr/bin physically resided ...
7
votes
4answers
3k views

How does one atomically change a symlink to a directory in busybox?

I am trying to (as close as possibly) atomically change a symlink. I've tried: ln -sf other_dir existing_symlink That just put the new symlink in the directory that existing_symlink pointed to. ln ...
4
votes
1answer
411 views

How to use diff tool to take a diff between directories with libraries and source?

I would like to know if i can use the diff tool to take the difference between two folders which contain sources as well as libraries and executable. Right now i gave diff -Naur dir1/ dir2/ ...
1
vote
0answers
141 views

How can I list only the directories present in a directory using ls? [duplicate]

Possible Duplicate: Is there any option with 'ls' command that I see only the directories? I have a directory with a lot of files but only a few directories. To get a list of only ...
10
votes
2answers
2k views

games directory?

On a standard filesystem, we have: /usr/games /usr/lib/games /usr/local/games /usr/share/games /var/games /var/lib/games Is this a joke, or is there some history behind this? What is it for? Why do ...