While learning how to write scripts and work solely through the terminal I am experiencing an issue in regards to overwriting a .jpg
with the message:
mv: try to overwrite foo.jpg, overriding mode 0555 (r-xr-xr-r)?
I was curious to know:
- What causes this error message?
- Why is this message not displayed for every image but some images?
- How can I correct this?
EDIT:
Would also like to know what r-xr-xr-r
mean and how I can use them.
You are having problems with 'file permissions'. Every file has a set of permissions attached to it that allow it to be read, written to or executed by users.
Some users can do all three things - read, write and execute. But some can't.
The 0555 indicates that the file you are moving has not got the full set of permissions set for any user. If they were all set so that everyone could do everything, the numbers would be 0777.
How do those numbers work? They represent three bits that can be set for you, 'the group' and everyone else to access the file. In binary arithmetic the first bit set is 1, the next is 2 and the next is 4. So if the file is readable, writable and executable to all it would be 1+2+4 = 7.
You are getting 0555, so you have 1+0+4. So your second bit isn't set for you or group or anyone. Therefore no one has permission to write (or move) that file.
Open a terminal and type 'chmod 755 foo.jpg' and try again. That should give you full persmission on the file if you own it. If it doesn't work, type
You should do some reading about file permissions for UNIX/LINUX type systems. It is what makes it more secure from viruses and malware etc.