Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.)

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer

ls (Short list) doesn't show hidden files.
ll (Long list, typically a shell alias to ls -alF) does.

share|improve this answer
    
Please read the question. ll does not see hidden files. Try it. –  H2ONaCl Oct 15 '11 at 11:06
    
Yeah it does. Anyway, it does backup hidden files simply because you order it to... man tar or tar --help. –  RobinJ Oct 15 '11 at 11:13
    
@broiyan. ll isn't actually a program: it's a shell alias. Exactly what it's an alias too may differ. Try type ll to see what it's aliased to on your system. –  TRiG Nov 9 '13 at 0:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.