26
Tar did a weird thing today
(sopuli.xyz)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
*
in your commands is expanded by the shell before tar sees them. It also does not expand hidden files.So when you do
admin/*
the shell expands to all non hidden files inside admin. Which does not includeadmin/.htaccess
. So tar is never told to archive this file, only the other non hidden files and folders. It will still archive hidden files and folders nested deeper though.In the second example
*
expands toadmin
and the other does which are not hidden at that level. Then tar can open these dirs and recursivly archive all files and folders including the hidden ones.You can see what commands actually get executed after any shell expansions if you run
set -x
first. Thenset +x
to turn that off again.Here is an example using
ls
:A quicker way to test this is by using echo
try
echo tar czf ~/package.tgz admin/* api/* mobile/*