Oh-My-Zsh - Why did my ls colors for directories change after copying to usb?
It's because of rwxrwxrwx
permissions set to every directory and every file in your copy. This may be because:
- the filesystem on your USB doesn't support permissions and ownership in Unix way;
- or it was mounted in a way that overrides this;
- or you copied your files and directories in a way that doesn't preserve permissions (research
cp -a …
).
Compare to this question and comments there. Especially:
If you save the files in a tarball, you can preserve all of the ext4 filesystem metadata. You don't have to lose anything.
It says about ext4
(and you probably use some other filesystem) but the situation is similar. I think a tarball created from the original files/directories would be the best solution.
rwxrwxrwx
means every user can mess with these files and directories, so it's a big deal in multi-user environment. Additionally some programs (e.g. ssh
) may refuse to work if some of their files are accessible to other users.
Related videos on Youtube
Elliot Tregoning
Updated on September 18, 2022Comments
-
Elliot Tregoning over 1 year
I apologize if this seems like a dumb question, but I can't seem to find the answer for it anywhere.
I need to have my home directory reset on my school computer, so I copied my important files to a USB, but when I copied the USB contents back onto the computer to make sure it copied them properly, I noticed that on one of my projects, the directories show up highlighted with yellow background and black text when I use ls, as opposed to the usual light blue color they normally show up in. What does this mean? I want to make sure this isn't a problem before I let them nuke my original files from my home directory.
I am using oh-my-zsh in iTerm2 with the default theme, running OSX Sierra. I've added pictures so you can see what I'm referring to. For some reason it only does it on 1 project and I can't seem to figure out why.
Normal LS colors:
'Highlighted' directory names:
EDIT - added
ls -la
output,file *
output andecho $LSCOLORS
outputls -la
output:echo $LSCOLORS
output (same for both):file *
output (same for both):-
Spiff over 6 yearsIt would help to see an
ls -l
and afile *
of both directories and see how they differ. Also the output of "echo $LSCOLORS" would be nice to see. -
Elliot Tregoning over 6 years@Spiff - I have edited the original post with those outputs, however I used
ls -la
instead ofls -l
because the output forls -l
was the same, it was just in a list instead.
-
-
Elliot Tregoning over 6 yearsI try to do as much as I can using the terminal, but this time I just dragged it from it's directory onto the usb using finder. So you are saying using -a will preserve the permissions? I will try doing that first and if it doesn't work I'll just make a tarball. Thanks.