Tag Info

New answers tagged


chmod -f 777 file.txt || true As it's an OR, if one of the statements returns true, then the the return is true. This results in an exit status of zero.


When you change a file's metadata (permissions, ownership, timestamps, …), you aren't changing the directory, you're changing the file's inode. This requires the x permission on the directory (to access the file), and ownership of the file (only the user who owns the file can change its permissions). I think this is intuitive if you remember that files can ...


I really dislike unexplained {} and \ markup and don't care much for the ; either! In the alternative, if the {} and \; are overly troublesome, there is an alternative approach. In addition, this approach handles spaces in the file name better than the find ... -exec formulation. find . -type d -print0 | xargs -0 chmod MASK find . -type f -print0 | ...


I would use the install tool to copy from NTFS. install -m644 file1 ... fileN destination_directory


You could use a script for your own user-defined cp command that checks file extensions and uses chmod appropriately... You could do something simple like: (using install rather than cp chmod as per @fd0. That's smarter anyway.) #!/bin/bash args=("$@") dest="${args[@]:(-1)}" unset args[${#args[@]}-1] if [ ! -d "$dest" ]; then echo "Please specify a ...


After getting my question answered here and doing some research about the outcome I found an article which explains it all very well. I would like to share some parts of this article here for future references. Viewing permissions In order to use chmod to change permissions of a file or directory, you will first need to know what the current mode of access ...


This command on Mac under sh stat -f "%Lp %N" your_files if you only want the numeric permission, use %Lp only. for example: stat -f "%Lp %N" ~/Desktop 700 Desktop The 700 is the numeric permission which can be used in chmod, and Desktop is the filename.

Top 50 recent answers are included