Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 6016  / 2 Years ago, wed, april 13, 2022, 5:01:03

Why does tar cvpfz /tmp/backup.tgz . backup hidden files?



(Note ls . does not see the hidden files. Trivia: there are ways to see hidden files such as with ls -a but this is just trivia. The question pertains to a difference in the behaviour when similar behaviour might be expected.)


More From » tar

 Answers
6

Quick answer: use ls -a to see the "hidden" files.



Long story: there's no such thing as a "hidden" file in UNIX/Linux, in the sense that the Linux kernel does not mark "hidden" files in any special way (as opposed, e.g., to what Windows does).



There is however a convention that file names starting with a dot character . are not displayed by ls unless the user explicitly asks for it (hence, the -a option). Since this was the convention adopted by the ls program (one of the first commands that existed in UNIX), it was followed by other file-display utilities, like Nautilus and the graphical file selection dialog.



On the other hand, since it's only a convention on displaying files, it does not affect other file-manipulating commands like tar.


[#42986] Thursday, April 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;