Tag Info

New answers tagged

0

Is this analogy of mine correct, or is it a big blunder? I think it's correct, you need wx permission to be able to write to a folder. Irrespective of the previous answer, is there any situation where having a folder with permissions as described is appropriate? You may have a process that writes information in a folder and another ...


3

Unfortunately you cannot do what you seek. While the directory may be held open, the files that reside within the directory are not part of the directory itself. The directory simply stores the file names. In addition to this, with the files having been deleted, the directory has already been modified to remove those files. In short, unless each individual ...


2

Colors The coloring is controlled by the DIR_COLORS* files that reside under `/etc. For example on Fedora 19 I have the following 3 files: $ ls -l /etc/DIR_COLORS* -rw-r--r--. 1 root root 5004 Jan 20 2014 /etc/DIR_COLORS -rw-r--r--. 1 root root 5682 Jan 20 2014 /etc/DIR_COLORS.256color -rw-r--r--. 1 root root 4646 Jan 20 2014 ...


2

Go to the directory where you want to create the link and run the following command: ln -s ./ 2015 The ln command creates links, see man ln: -s, --symbolic make symbolic links instead of hard links


2

This is a symbolic link. Go the directory where they are pointing to and execute: ln -s . 2015 should do it. Note the destination shall not exist. If there is currently a directory named 2015 move it before linking.


1

It's possible with SGID. So can read more on this here: http://linoxide.com/how-tos/stickbit-suid-guid/ Example on how to actually do it: Implementation of SGID on directory: # chmod g+s /test/ # ls -ld /test drwxrwsrwx 2 root root 4096 Mar 8 03:12 /test Now swich to other user and create a file in /test directory. # su - roger $ cd /test/ $ touch ...


3

A program that acts on the contents of a file always acts on the target, not on the symbolic link, because symbolic links have no contents of their own. A program that acts on the metadata of a file (timestamps, owner, permissions, …) usually acts on the target, but some programs have options to act on the symbolic link instead (for example, chown -h, touch ...


2

Assuming the file and directory names don't have newlines in them: diff <(cd alpha ; find . -type f) <(cd beta; find . -type f) The find commands list the files in the directories the cd changed to and the diff compares the listings. Output looks like: 1c1,2 < ./b/c/file.x --- > ./b/c/file.d > ./b/c/file.e with < indicating files ...


3

There are several smart extraction tools out there (which I found out after I wrote one for myself). You may want to look at dtrx ( install with sudo apt-get install dtrx). dtrx always creates the toplevel directory if that is not yet in the archive. Adapting your bash wrapper script (that calls dtrx instead of unzip) then becomes much more simple as it ...


2

I would suggest simply: Extract into a fresh new directory If, after extraction, the new directory contains exactly one subdirectory, then move all of the files inside it up one level and get rid of the original subdirectory. By the way, making an archive (tar, zip, whatever) without having all of the members of the archive inside of a subdirectory is ...


0

The proper solution to something like this in puppet is to create a defined type: define folder_link ( $link_map = $name, ) { $link_map_split = split($link_map, ':') $origin = $link_map_split[0] $link_name = $link_map_split[1] $link_path = "/folders_1_to_x/yy/$link_name" file { $link_path: ensure => link, target => $origin, } } class foo ...


8

You can use cp's --parents switch: $ mkdir -p step1/step2/step3 $ touch step1/step2/step3/file $ mkdir copy $ cp --parents step1/step2/step3/file copy $ ls copy/step1/step2/step3/file copy/step1/step2/step3/file mv, however, does not have a --parents switch, but you could do something like: $ find step1/step2/step3 -name "file" -exec cp --parents {} ...


3

. is not a variable with a value. It is a (special) file in the filesystem. You cannot change it.


2

There isn't any native mechanism to easily achieve it. Linux's permission system cannot specify separate permissions for creating files and directories because directories are files in fact. But try such way: Make all archive directories to be owned by a one (or few different) user, created just for this purpose. Lets assume its name archiveuser. Make all ...


2

Linux forbids renaming any path that ends in the component . or .., returning the error EBUSY; the following will also fail: $ mkdir a a/aa $ mv a/aa/.. b mv: cannot move ‘a/aa/..’ to ‘b/..’: Device or resource busy The code for this is in namei.c::renameat. The last component of the pathname when passed to various functions needs to be of type LAST_NORM, ...


3

The reason you're getting the message: mv: cannot move .' to../general/.': Device or resource busy is due to how the ., and .. work in addition to mv. When you move something in Unix, the mv command attempts to unlink everything that references the inode of the item that you're attempting to move. In this case that would be the inode of whatever the ...


5

It is not possible to move a dot .. The dot is not the same as current directory name. You can think about . as a pointer to the directory, but not the directory itself, therefore, $ pwd && echo $PWD && realpath . /home/jimmij/tmp /home/jimmij/tmp /home/jimmij/tmp $ mkdir tmp1 tmp2 $ mv tmp1/. tmp2/ mv: cannot move ‘tmp1/.’ to ‘tmp2/.’: ...


4

You can't move the directory you're current in. The current process is the one that's keeping it busy. Instead, go up one level and name the previously-current directory to move it to the target.


1

Every directory has at least two references: one from its parent directory (the Volumes entry in /), and one from its own . entry. If there are subdirectories, each has a .. entry that refers back to the parent, and those also contribute toward the parent's link count. So your /Volumes directory's link count of 9 consists of one from /, plus one from ...


0

. represents the current directory, where as .. represents the parent directory. For example, currently I am in demo directory $cd demo/dir1 $pwd /home/guru/demo/dir1 <- my current directory $cd . $pwd /home/guru/demo/dir1 <- cd again to my current directory cd .. $pwd /home/guru/demo <- cd to parent directory


1

Suppose that there are five hard links for /home. The five hard links are /home/., /home/.., and for the three subdirs s of /home /home/s/... Note that if /home is on its own partition, then the references to /home/.. and /home/. are identical, however /home/.. is nonetheless evaluated to /. This is because every directory has entries for . and .., even a ...


1

-Yeah, you see any partitions independently of what the name is a sub-partition "Root - / " because it is the primary partition of the system it is the whole system, hence the name "root" starts as a tree that starts at the root, the same occurs in the system, only it is not for this that also have other partitions starting or being present on the same disk, ...


1

In my Ubuntu 12.04, /home and / are different partitions. But why does /home look like a subdirectory of /? Partitions and directory structure are two completely separate things. One has nothing to do with the other. /home is a subdirectory of /. How can I show all the hard links for /home? I don't believe that there is any easy command to show ...


2

In your Ubuntu 12.04, "/" and "/home" are mounted under different partitions. The mount command will show you the structure of your partition mounting. These are not accomplished by hard links. These are mount points. Linux Directory Structure Map Mount Manual umount manual FSTab Manual The FSTab is where you system gets/sets static mount points for ...


0

I didn't want new executables nor clunky solutions so here's my take: #!/bin/sh # md5dir.sh by Camilo Martin, 2014-10-01. # Give this a parameter and it will calculate an md5 of the directory's contents. # It only takes into account file contents and paths relative to the directory's root. # This means that two dirs with different names and locations can ...


7

Because bash (and possibly other shells) track the path you descended, including symlinks, in order to make your trail back up look like the one down. Bash knows how you got to the working directory because cd must be a shell built-in. When you run ls .. the shell can't substitute the "symbolic path" because grep .. is also valid and translating .. would be ...


3

Comparing filesystem structures We want to compare filesystem structures looking for non-aesthetic differences. We compare hierarchical filesystems with a tree structure of directories, with flat filesystems that have only one place that contains all files, similar to a single directory with no subdirectories. The two main types of differences are in CPU ...



Top 50 recent answers are included