A file system structure in which to store computer files.

learn more… | top users | synonyms

4
votes
2answers
5k views

How to make tree output only directories?

150 directories I can handle but 900 files is too many for a review. I've no manual entry for tree so maybe I can ask you if you know how to output only directories since files get too detailed? . ...
155
votes
3answers
69k views

How do directory permissions in Linux work?

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, and how do directory permissions in Linux ...
3
votes
1answer
1k 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 ...
1
vote
3answers
4k views

Replace symbolic link which linked to directory target

I want to upgrade tomcat server from 7.0.19 to 7.0.20. I've already ln -s apache-tomcat-7.0.19 tomcat7 before, so now I need to link tomcat7 to new target using the following command ln -s --force ...
22
votes
3answers
13k views

Is there any way to prevent deletion of certain files from user owned directory?

Let's say user has Directory1 and it contains File1 File2 CantBeDeletedFile How to make so the user would never be allowed to delete the CantBeDeletedFile? If I change the ownership of Directory1 and ...
4
votes
3answers
377 views

Delete files in a directory which are also in another directory

I copied a directory using this: cp -r dir/ ../../ without thinking and realized that it copied the contents of dir instead of actually dir to the above directory. Now I have a mess of files I need ...
2
votes
1answer
2k views

How can I make ls show information about the directory specified only, not info about its sub-files or folder contents?

Say I have folder "foo" residing, the home directory. I want to get some info of it, owner, group, permissions, etc... I then do this to try to get the information: cd ~ ls -l foo Of course it now ...
3
votes
2answers
401 views

Permissions of webserver's root directory

I've had this issue on several setups, and I'm unsure of how to handle it. At first, all of /var is owned by root:root. Clearly I don't want the web directory to be owned by root, so I do chown ...
5
votes
2answers
3k 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 ...
9
votes
4answers
5k views

How are directories implemented in Unix filesystems?

My question is how directories are implemented? I can believe a data structure like a variable e.g. table, array or similar. Since UNIX is Open Source I can look in the source what the program does ...
3
votes
2answers
7k views

How can I have a separate umask for directory or user?

I want a separate umask for a directory or a user. How can I do this? Edit: I am using Debian 6. The reason why I want to do this is, I want all my SFTP users to create files with write on group. ...
6
votes
4answers
13k views

How to recursively list all hidden files and directories?

I want to list all hidden files and directories and then save result to file. Is there any command for this?
5
votes
1answer
7k views

In Linux, “Write” Permission Is Equivalent To “Execute” For Directories?

The Execute permission makes sense for files (which include scripts etc), but when it comes to directories, write (w) permission works the same way as execute (x), right? Which means, if we are giving ...
5
votes
4answers
714 views

Equivalent of forward/back buttons for unix shell (when navigating directories)?

I'd like to be able to type in terminal commands of forward/back especially if I went from a directory with a super-long name to home (and want to return back to the directory with the super-long ...
5
votes
2answers
186 views

How does bash continue to work correctly when you move its working directory?

On Linux, I moved a directory to another directory using mv, and in another shell, my working directory happened to be the directory that was moved. I ran hg pull in that shell, and to my surprise, ...
2
votes
1answer
19k views

How to move a file to /usr/local in Ubuntu?

I am working in the most recent Ubuntu in a 64 bit machine. I am currently on the Gnome command prompt and I am trying to move a file under the Downloads directory to /usr/local. However, it gives me ...
2
votes
1answer
2k views

Why can't list file/directory relative to .. from a symbolic link directory (No such file or directory)?

I have a /usr/tomcat6/logs directory linked to /var/log/tomcat6. When I changed directory to /usr/tomcat6/logs and try to ls files using a relative pathname ../conf/Catalina/localhost, a No such file ...
8
votes
2answers
2k views

Is there a correct way to list the subdirectories of the current directory?

I can find the subdirectories of a directory by ls -d -- */ or ls -l | grep "^d" but both of these seem indirect, and I would imagine that there would be a standard way to find just the ...
1
vote
1answer
2k views

reading cifs share fails with permission denied - cifs samba directory permission denied

I'm trying to setup a samba server to share data among clients via cifs. As a test, I mounted the samba share on the same machine and tried to access the contents of the directory. The mount command ...
4
votes
2answers
587 views

Searching for string in files

Is there an easy way to search inside 1000s of files in a complex directory structure to find files which contain a specific string within the file?
4
votes
3answers
577 views

mkdir based on input from other directories

I have a directory full of albums I've ripped to FLAC format. Folders are named "Artist - Album [flac]" I need to create matching directories named "Artist - Album [mp3]" but only for certain ...
4
votes
2answers
160 views

Can an executable know where it is stored?

Can an executable know where it is stored? For my open source project, I wrote a small bash script to automate some operations. The script lies at the root of the project and performs its tasks on ...
3
votes
6answers
2k views

finding the absolute directory

Here is the scenario: foo/ > data/ > stuff/ > scripts/ -> /.../generic/scripts When calling foo/scripts/bar.sh from any location (other folder or inside the folder), I would like to be ...
8
votes
5answers
3k views

Bash CD up until in certain folder

I do a lot of work in Magento, and so do a lot of the people I work with, and it gets annoying to have to type: cd ../../../../../../ To only find you're still a few directories from your root ...
7
votes
3answers
467 views

“mkdir foo; svn mv * foo”

I often want to do some variant of this idiom: $ mkdir 2010 $ svn mv * 2010 Of course, I get an error because the glob matches 2010 as well: svn: Cannot copy path '2010' into its own child ...
5
votes
2answers
80 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 ...
40
votes
2answers
26k views

Do the parent directory's permissions matter when accessing a subdirectory?

If I have a root folder with some restrictive permission, let's say 600, and if the child folders/files have 777 permission will everybody be able to read/write/execute the child file even though the ...
3
votes
2answers
1k 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 ...
0
votes
1answer
204 views

GCC installation prefix under Linux [duplicate]

Possible Duplicate: Where should I put software I compile myself? Following this qustion, is there a recommended prefix for GCC installation under Linux? I am not trying to achieve anything ...
19
votes
9answers
94k 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 ...
2
votes
1answer
255 views

Switch back to path when resume job from background

Say I open ~/vim.txt, push that to background, then cd to another path. When I bring that job to foreground, is there an option to switch back to old path? I noticed it says pwd, so I assume it is ...
21
votes
6answers
6k 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 ...
4
votes
3answers
324 views

Open files in emacs by filename instead of complete path

Assume I have a bunch of directories and can guarantee that no two directories have a common filename (i.e. if foo/bar exists, then bar doesn't exist in any of the other directories). How can I setup ...
6
votes
2answers
375 views

Using NIS without NFS

I'm configuring several computers in a lab to operate with the same login credentials shared between the computers, but without sharing the home directories. I'm considering using NIS for sharing the ...
4
votes
2answers
548 views

Shell script printing the most visited directories

Is there a way to write a bash script with the following functionalities? Be launched when I press some key or key combination. (not so important requirement) Identify the 7 most visited directories ...
1
vote
1answer
626 views

Execute file in its native directory with shell script

I'm executing a php file from the php-cli with a shell script. One of the php files creates a file named available_data during the course of its execution. The problem is that the php file needs to ...
40
votes
5answers
16k views

How can I create a /dev/null-like “blackhole” directory?

I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear. I have an application that writes out large ...
3
votes
4answers
11k views

programmatically creating a remote directory using ssh

Using a shell script, how can I create a directory remotely from serverA -> serverB using ssh? Can I pass the create directory command with the ssh command? How? I'm basically looking to create a ...
27
votes
3answers
9k views

How to remove all empty directories in a subtree?

How can I remove all empty directories in a subtree? I used something like find . -type d -exec rmdir {} 2>/dev/null \; but I needs to be run multiple times in order to remove directories ...
2
votes
3answers
6k views

use 'find' to search for directories !containing certain filetype foo

I have a few directories, some with a depth of 3, which contain mixed file types. What I need to do is to rm -rf all the subdirectories that do not contain filetype foo. Is this achievable with find ...
2
votes
4answers
2k views

Wget command that returns [a list of] all webpages on a webserver

Let's say we have a website www.example.com with the following pages: www.example.com/page1 www.example.com/unknown www.example.com/unknown Is there a Wget command that would produce the following ...
2
votes
2answers
571 views

How many entries are created when you make a new directory in *nix?

As per the question, I am thinking mkdir ~/a is either two or three: 1 entry for the dir it sits in (~/a) 1 entry for itself (cd a && ls .) and/or 1 entry for itself again (cd a && ...
7
votes
1answer
813 views

Is there a tool that hooks to two directories and synchronizes them as soon as something changes?

I have huge simulation directories on the two machines server and on cluster which I want to keep synchronized. The basic situation is that files rarely change but when a simulation is done many big ...
11
votes
4answers
2k views

Should I include a trailing slash / in a symlink to a directory?

Symlinking to a directory gives to different results with ls -l depending on whether I ln -s dir or ln -s dir/. But what's the actual difference, and which one should I prefer why?
0
votes
1answer
1k views

How to copy files nested in directories that match a pattern?

I'm looking to copy files from subdirectories that match this pattern vendor/plugin/*/tasks/*.rake into a folder lib/tasks I think that this could be done several ways, but wanted to see if a ...
2
votes
1answer
10k views

`chmod 770 folderName` restrics access to subdirectories & subfiles?

If I run chmod 770 ./folderName, then users who are not the owner or in the group owning ./folderName (i.e. users in the “others” category) cannot access ./folderName/folderB or ./folderName/fileC, ...
11
votes
7answers
8k views

How to check if $PWD is a subdirectory of a given path

E.g. check if $PWD is a subdirectory of /home. In other words I'm searching for a bash string operation to check if one string starts with another.
17
votes
6answers
3k views

Any way to sync directory structure when the files are already on both sides?

I have two drives with the same files, but the directory structure is totally different. Is there any way to 'move' all the files on the destination side so that they match the structure of the ...
3
votes
2answers
2k views

Encode directory with GnuPG

Is there any way to encrypt the whole directory using gpg? It accepts only file as input argument. But I need to encrypt a lot of files on external HDD.
43
votes
5answers
26k 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 ...