As a Linux user for 2 years, I am glad to say I left the Windows ecosystem. Now my use cases for my computer isn't the same for everyone else, but I can safely say my life has improved when switching to Linux. I actually cannot switch back to Windows 10, as there is a severe learning curve that is bigger than getting into Linux when I was a Windows 10 user. I appreciate this article, but some tidbits. First, amazing choice picking Ubuntu as the recommendation. 2nd, in CHMOD, when wanting to do quick changes to a file it is easily all you need to do is chmod +/-<permission_char> so to give something like my ever-so-lovely sass.sh file permissions to execute it is chmod +x sass.sh, and to remove said permission is chmod -x sass.sh. With updating and installing software, another tidbit, apt-get is being replaced for apt, which is the same game different name. Another tidbit, to copy directories, do cp -r origDirectory newDirectory! I have also learned with that same cp -r trick, you can do it to the directory you are in by doing cp -r . newDirectory, the dot is one of the most useful tools in Linux. Lastly, the tilda. Always remember the tilda (~) means your HOME directory. Meaning if you do rm ~/random-file for example, it will delete /home/thisuser/randomfile, will make life a heck of a lot easier.
Does cp -r preserve directory timestamp or does it restamp with current date/time? Using GUI didn't preserve (was using Ubuntu 16.04.8 lxde desktop). Now I've started using tar to compress then extract with preserve timestamps switch
I just tried it out and no, apparently it doesn't.
EDIT: man cp and a quick search for timestamp reveals that when copy is called with the -p option, it should preserve timestamps. Not sure if this is a GNU thing though, but even busybox seems to support his flag.
Thank you, man! Really appreciate your suggestions.
After reading your comment, I really felt that I hadn't done proper justice to the chmod command, and made it somewhat fearful for new users to try out. I have made a few changes to the post, regarding the same.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As a Linux user for 2 years, I am glad to say I left the Windows ecosystem. Now my use cases for my computer isn't the same for everyone else, but I can safely say my life has improved when switching to Linux. I actually cannot switch back to Windows 10, as there is a severe learning curve that is bigger than getting into Linux when I was a Windows 10 user. I appreciate this article, but some tidbits. First, amazing choice picking Ubuntu as the recommendation. 2nd, in CHMOD, when wanting to do quick changes to a file it is easily all you need to do is
chmod +/-<permission_char>
so to give something like my ever-so-lovelysass.sh
file permissions to execute it ischmod +x sass.sh
, and to remove said permission ischmod -x sass.sh
. With updating and installing software, another tidbit,apt-get
is being replaced forapt
, which is the same game different name. Another tidbit, to copy directories, docp -r origDirectory newDirectory
! I have also learned with that samecp -r
trick, you can do it to the directory you are in by doingcp -r . newDirectory
, the dot is one of the most useful tools in Linux. Lastly, the tilda. Always remember the tilda (~
) means your HOME directory. Meaning if you dorm ~/random-file
for example, it will delete/home/thisuser/randomfile
, will make life a heck of a lot easier.Does cp -r preserve directory timestamp or does it restamp with current date/time? Using GUI didn't preserve (was using Ubuntu 16.04.8 lxde desktop). Now I've started using tar to compress then extract with preserve timestamps switch
That is a question I do not know the answer to
A unix and linux forum had the answer (unix.stackexchange.com/questions/4...
cp -r --preserve=timestamps SOURCE DESTINATION
No need to tar compress then tar extract with preserve time stamp switch.
I tested the above 'cp -r --preserve=timestamps SOURCE DESTINATION' command and it works like a dream.
You also can use
rsync
I just tried it out and no, apparently it doesn't.
EDIT:
man cp
and a quick search fortimestamp
reveals that when copy is called with the-p
option, it should preserve timestamps. Not sure if this is a GNU thing though, but even busybox seems to support his flag.Name checks out
Thank you, man! Really appreciate your suggestions.
After reading your comment, I really felt that I hadn't done proper justice to the chmod command, and made it somewhat fearful for new users to try out. I have made a few changes to the post, regarding the same.