New answers tagged

1 vote

What subdirectories of a user's home directory does the user have full control over?

By default, other unprivileged users cannot create subdirectories in your home directory. If they were able to do so that would be a huge security hole. However, as said by @Jörg, the privileged user (...
dr_'s user avatar
  • 29.2k
0 votes

Checking if there's a file with a particular name in a lot of directories

Similar to @waltinator's comm utility idea, grep can be useful in removing a set of strings from its standard input. $ find mypath/ -type d | grep -Fvxf <(find mypath/ -name \*.bam -type f -...
Jim L.'s user avatar
  • 7,469
0 votes

Checking if there's a file with a particular name in a lot of directories

With the bash shell, you can test whether the current directory contains any names ending in .bam, and print a message if it doesn't, like so: shopt -s dotglob nullglob set -- ./*.bam [ "$#" ...
Kusalananda's user avatar
  • 327k
1 vote

Checking if there's a file with a particular name in a lot of directories

In zsh: if ()(($#)) **/*.bam(ND.Y1)); then print There is at least one regular file in here whose name ends in .bam fi directories_without_bam=( **/*(ND/^e['()(($#)) $REPLY/*.bam(ND.Y1)']) ) if (...
Stéphane Chazelas's user avatar
0 votes

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

You asked about Linux specifically, but just for the benefit of other readers of these questions, BSD and macOS have chflags which can also be used to completely protect the files (and not just from ...
Mattie's user avatar
  • 105
0 votes
Accepted

What subdirectories of a user's home directory does the user have full control over?

None. The system administrator can always override any restrictions.
Jörg W Mittag's user avatar
0 votes

Any command to exclude all types of files only?

You can use the following rsync options to only copy directory tree : rsync -av -f"+ */" -f"- *" /path/to/src /path/to/dest/ Command explained in details there : https://www....
Bertrand Cebador's user avatar
1 vote

find & cp command doesn't copy 1st level directory

-maxdepth 1 is a directive for find. Because of it your find will run cp … for ./1 and it won't run cp … for ./1/1-1; and so on. Note it will run cp … for . in the first place. When your find runs cp -...
Kamil Maciorowski's user avatar
1 vote

Copy directory not just the contents

Also, make sure that the first argument (the directory you want to copy) doesn't end with a forward-slash character /. Some versions of cp (for example on MacOS) treat it as /* and copy just the ...
David Ferenczy Rogožan's user avatar

Top 50 recent answers are included