Tag Info

Hot answers tagged

31

You can. You just have to set the executable bit on the /a/b directory. That will prevent being able to see anything in b, but you can still do everything if you go directly to a/b/c. % mkdir -p a/b/c % chmod 711 a/b % sudo chown root a/b % ll a/b ls: cannot open directory a/b: Permission denied % touch a/b/c/this.txt % ls a/b/c this.txt Beware that ...


12

Accepting command options arguments after file operands is not standard and isn't often supported in non-GNU system, you need: ls -d1 sel* A note that -d1 isn't depth 1 like you think. -d tell ls list directories themselves, not their content -1 tell ls list one entry per line


8

With those permissions, you can't reach your goal. In order to get to directory c, you must allow all other users to traverse directory b which is done by giving execute permission for that directory. With /a/b set to mode 711, you can achieve what you want since you are granting directory traversal but denying read and write. But do keep in mind that while ...


7

use ls -l -d /tmp/ and you will see that the permissions are set to drwxrwxrwt, i.e. d: a directory, rwx: read, write and execute permissions allowed for owner, group and others (in this order), t sticky bit, i.e. only file owners are allowed to delete files (not the group despite permissions). Let's leave the sticky bit aside for the moment and mention that ...


6

find will set its return code to non-zero if it saw an error. So you can do: if ! find ... then echo had an error >&2 fi | while ... (I'm not sure what you want to do with the find output). To collect all the error messages from find on stderr (file descriptor 2) you can redirect 2 to a file. Eg: if ! find ... 2>/tmp/errors then ...


6

When you run emacs it creates a backup file, int his case test.txt~. If there was already a file with that name I suspect it deletes it and creates a new one. That new file creation is modifying the directory, and thus updating its modified and changed times. If you were, instead, to say echo new line >> blah.txt you would not be creating any extra ...


5

I don't think that there is a concept of "directory created by system". When you're installing your system, installation media often gets job done for you - you see the result(e.g. /etc directory created), but that really is done by user who happened to run script. Anything created by "system" could be treated as created by root, but there's no way of ...


5

Tracking freed blocks is unavoidable in any decent file system and ZFS is no exception. There is however a simple way under ZFS to have a nearly instantaneous directory deletion by deferring the underlying cleanup. It is technically very similar to Gilles' suggestion but is inherently reliable without requiring extra code. If you create a snapshot of your ...


4

What you're asking for is impossible. Or, more precisely, there's a cost to pay when deleting a directory and its files; if you don't pay it at the time of the deletion, you'll have to pay it elsewhere. You aren't just removing a directory — that would be near-instantaneous. You're removing a directory and all the files inside it and also recursively ...


3

If you are trying to delete a directory foo/bar/, the permissions of bar isn't the relevant factor. Removing the name bar from directory foo is a modification of foo. So you need write permissions on foo. In your case, check the current directory's permissions with ls -ld . You might find this answer to "why is rm allowed to delete a file under ownership ...


2

If a user can't access /a/b, then they can't access any file under /a/b/c. The permissions on /a/b/c are irrelevant since directory traversal stops at /a/b. If all you want is to prevent the directory /a/b from being listed, but you're fine with users accessing files in /a/b if they guess a file name, then you can make /a/b executable but not readable. On a ...


2

There is no difference between files (including directories) created by the system or by a user because in the end it is the same system call. Later on it is impossible to tell who was the owner of the process which created the file or directory. By the way, "the Linux system" is mostly the user root: there is no special user. Furthermore, installing always ...


2

Depending on what you mean by "created by system", you may be able to use the packaging system to determine how a particular directory was created. For example, on an RPM-based system (e.g. RedHat, Fedora, CentOS etc): rpm -qf /var will give something like filesystem-2.4.100.x86_64 indicating it was installed as part of the filesystem package, whereas ...


2

Use this: find -name "* *" -print0 | sort -rz | \ while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done find will search for files and folders with a space in the name. This will be printed (-print0) with nullbytes as delimiters to cope with special filenames too. The sort -rz reverses the file order, so that the deepest ...


2

This should do it. Where the first column (size) exceeds 10gb, output the second column (directory name) du -sk * | awk '$1 > 10485760 { print $2 }' Or as requested, to show in human readable form, as below. The regular expression ensures column 1 ends in a G (gigabytes) and the substr part strips the final letter from column 1 and looks to see if ...


1

> So why can apache open this directory (dir1) ? I haven't an answer for this, normally it should not be able to. > It is possible to make a group in a group ? No, in Linux all group members must be users. > Or to made a group the owner of a directory ? Yes, you can assign ownership of a directory to a user and a group via the command chmod ...


1

The cache that matters most for directory traversal is the inode cache. This isn't included in the “cache” figure that free displays. It's part of the kernel data (the “slab”). You can see how much memory the various slab pools occupy in /proc/slabinfo (this requires root access). You can use slabtop to see them vary in real time, or this snippet to get a ...


1

If it has to be quick, I generate a new temporary directory, mv the directory below it and then recursively delete the temporary: t=`mktemp -d` mv certainFolder $t/ rm -rf $t &


1

With zsh (using the glob qualifier D): print -rl ./**/.*(D) To include non-hidden files in hidden directories: setopt extendedglob print -rl ./**/*~^*/.*(D)



Only top voted, non community-wiki answers of a minimum length are eligible