Zip/Tar file compressed to larger size? [duplicate]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
This question already has an answer here:
What does size of a directory mean in output of 'ls -l' command?
4 answers
I have 4 files that I want to include them in a .zip file.
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
As you can see in total their size is 16K.
After
I am creating the zip using the command bellow:
zip -r myfiles.zip *
The file was created successfully but now its size is 20M, as you can see bellow!
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
-rw-rw-r-- 1 skemelio themelis 20M Απρ 4 02:00 myfiles.zip
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
What I've done wrong?
ps: Same thing (same size) happened when I try to create a .tar using tar cvf myfiles.tar *
.
tar zip compression
New contributor
marked as duplicate by Fabby, muru, Prvt_Yadv, Toby Speight, Mr Shunz 2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
show 2 more comments
This question already has an answer here:
What does size of a directory mean in output of 'ls -l' command?
4 answers
I have 4 files that I want to include them in a .zip file.
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
As you can see in total their size is 16K.
After
I am creating the zip using the command bellow:
zip -r myfiles.zip *
The file was created successfully but now its size is 20M, as you can see bellow!
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
-rw-rw-r-- 1 skemelio themelis 20M Απρ 4 02:00 myfiles.zip
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
What I've done wrong?
ps: Same thing (same size) happened when I try to create a .tar using tar cvf myfiles.tar *
.
tar zip compression
New contributor
marked as duplicate by Fabby, muru, Prvt_Yadv, Toby Speight, Mr Shunz 2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
A individual directory always shows the 4k size when viewed withls
- what you want to use to check before isdu
- ie,du -sh *
– ivanivan
Apr 3 at 23:08
1
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
1
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size thatls
reports for directories (that each directory was the exactly the same size should have been a hint that maybels
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly runzip
on a.zip
file to get increasingly smaller files.
– jamesdlin
2 days ago
1
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
1
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago
|
show 2 more comments
This question already has an answer here:
What does size of a directory mean in output of 'ls -l' command?
4 answers
I have 4 files that I want to include them in a .zip file.
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
As you can see in total their size is 16K.
After
I am creating the zip using the command bellow:
zip -r myfiles.zip *
The file was created successfully but now its size is 20M, as you can see bellow!
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
-rw-rw-r-- 1 skemelio themelis 20M Απρ 4 02:00 myfiles.zip
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
What I've done wrong?
ps: Same thing (same size) happened when I try to create a .tar using tar cvf myfiles.tar *
.
tar zip compression
New contributor
This question already has an answer here:
What does size of a directory mean in output of 'ls -l' command?
4 answers
I have 4 files that I want to include them in a .zip file.
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
As you can see in total their size is 16K.
After
I am creating the zip using the command bellow:
zip -r myfiles.zip *
The file was created successfully but now its size is 20M, as you can see bellow!
drwxr-xr-x 7 skemelio themelis 4,0K Οκτ 18 00:21 CSharp
drwxr-xr-x 11 skemelio themelis 4,0K Οκτ 18 00:17 gnome-games
drwxr-xr-x 8 skemelio themelis 4,0K Οκτ 18 00:17 gnome-music
-rw-rw-r-- 1 skemelio themelis 20M Απρ 4 02:00 myfiles.zip
drwxr-xr-x 4 skemelio themelis 4,0K Οκτ 18 00:18 Test
What I've done wrong?
ps: Same thing (same size) happened when I try to create a .tar using tar cvf myfiles.tar *
.
This question already has an answer here:
What does size of a directory mean in output of 'ls -l' command?
4 answers
tar zip compression
tar zip compression
New contributor
New contributor
edited 2 days ago
Stanowczo
1033
1033
New contributor
asked Apr 3 at 23:04
ThemelisThemelis
1314
1314
New contributor
New contributor
marked as duplicate by Fabby, muru, Prvt_Yadv, Toby Speight, Mr Shunz 2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Fabby, muru, Prvt_Yadv, Toby Speight, Mr Shunz 2 days ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
A individual directory always shows the 4k size when viewed withls
- what you want to use to check before isdu
- ie,du -sh *
– ivanivan
Apr 3 at 23:08
1
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
1
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size thatls
reports for directories (that each directory was the exactly the same size should have been a hint that maybels
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly runzip
on a.zip
file to get increasingly smaller files.
– jamesdlin
2 days ago
1
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
1
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago
|
show 2 more comments
1
A individual directory always shows the 4k size when viewed withls
- what you want to use to check before isdu
- ie,du -sh *
– ivanivan
Apr 3 at 23:08
1
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
1
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size thatls
reports for directories (that each directory was the exactly the same size should have been a hint that maybels
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly runzip
on a.zip
file to get increasingly smaller files.
– jamesdlin
2 days ago
1
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
1
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago
1
1
A individual directory always shows the 4k size when viewed with
ls
- what you want to use to check before is du
- ie, du -sh *
– ivanivan
Apr 3 at 23:08
A individual directory always shows the 4k size when viewed with
ls
- what you want to use to check before is du
- ie, du -sh *
– ivanivan
Apr 3 at 23:08
1
1
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
1
1
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size that
ls
reports for directories (that each directory was the exactly the same size should have been a hint that maybe ls
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly run zip
on a .zip
file to get increasingly smaller files.– jamesdlin
2 days ago
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size that
ls
reports for directories (that each directory was the exactly the same size should have been a hint that maybe ls
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly run zip
on a .zip
file to get increasingly smaller files.– jamesdlin
2 days ago
1
1
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
1
1
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago
|
show 2 more comments
1 Answer
1
active
oldest
votes
An individual directory always shows its own size when viewed with ls
- no matter the size of its contents. What you really want to use to check before is du
- ie, du -sh *
.
A good explanation of what the size of a directory means is on this Q&A - What does size of a directory mean in output of 'ls -l' command?
6
The size show by ls for a directory is notfalse
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.
– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
An individual directory always shows its own size when viewed with ls
- no matter the size of its contents. What you really want to use to check before is du
- ie, du -sh *
.
A good explanation of what the size of a directory means is on this Q&A - What does size of a directory mean in output of 'ls -l' command?
6
The size show by ls for a directory is notfalse
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.
– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
add a comment |
An individual directory always shows its own size when viewed with ls
- no matter the size of its contents. What you really want to use to check before is du
- ie, du -sh *
.
A good explanation of what the size of a directory means is on this Q&A - What does size of a directory mean in output of 'ls -l' command?
6
The size show by ls for a directory is notfalse
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.
– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
add a comment |
An individual directory always shows its own size when viewed with ls
- no matter the size of its contents. What you really want to use to check before is du
- ie, du -sh *
.
A good explanation of what the size of a directory means is on this Q&A - What does size of a directory mean in output of 'ls -l' command?
An individual directory always shows its own size when viewed with ls
- no matter the size of its contents. What you really want to use to check before is du
- ie, du -sh *
.
A good explanation of what the size of a directory means is on this Q&A - What does size of a directory mean in output of 'ls -l' command?
edited 2 days ago
Themelis
1314
1314
answered Apr 3 at 23:56
ivanivanivanivan
3,7871414
3,7871414
6
The size show by ls for a directory is notfalse
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.
– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
add a comment |
6
The size show by ls for a directory is notfalse
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.
– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
6
6
The size show by ls for a directory is not
false
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.– icarus
2 days ago
The size show by ls for a directory is not
false
, it is the size of the directory. However the size of a directory is related to the number of entries in it (possibly the largest number it every had), not the size of those entries.– icarus
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
So any directory takes 4K of disk space? It feels a lot!
– Themelis
2 days ago
1
1
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
@Themelis - or more. It is meta-data about the directory and contents, so if your directory has lots of files or subdirectories, etc it will get larger. Key is to remember the size shown for the directory is about the meta data, not the sum of the sizes of the contents of the directory.
– ivanivan
2 days ago
add a comment |
1
A individual directory always shows the 4k size when viewed with
ls
- what you want to use to check before isdu
- ie,du -sh *
– ivanivan
Apr 3 at 23:08
1
Ok I had no idea why this happens but you are right. Why don't you make it an answer?
– Themelis
Apr 3 at 23:10
1
FYI, 4K * 4 = 16K, not 32K. Also, in this case this is due to a misunderstanding of the size that
ls
reports for directories (that each directory was the exactly the same size should have been a hint that maybels
isn't reporting what you think), but in general you should not necessarily be surprised if compression sometimes produces a larger file. Compression can't compress everything; otherwise you could repeatedly runzip
on a.zip
file to get increasingly smaller files.– jamesdlin
2 days ago
1
"I have 4 files..." - No, you don't. You have 4 directories which makes all the difference here.
– mastov
2 days ago
1
@Themelis I stand corrected. They are "files", they are just not "regular files", which is important here.
– mastov
2 days ago