Linux Terminal 201: How To Use tar, gzip, bzip2, and zip - HakTip 156

Ғылым және технология

Hak5 -- Cyber Security Education, Inspiration, News & Community since 2005:
____________________________________________
Archiving vs Compression? What's the difference between tar, gzip, bzip2, and zip? We'll check out all of them, along with how to use each tool in the terminal on HakTip!
-------------------------------
Shop: www.hakshop.com
Support: / threatwire
Subscribe: / hak5
Our Site: www.hak5.org
Contact Us: / hak5
Threat Wire RSS: shannonmorse.podbean.com/feed/
Threat Wire iTunes: itunes.apple.com/us/podcast/t...
Help us with Translations! kzread.info_cs_p...
------------------------------
~-~~-~~~-~~-~
Please watch: "Bash Bunny Primer - Hak5 2225"
• Bash Bunny Primer - Ha...
~-~~-~~~-~~-~
____________________________________________
Founded in 2005, Hak5's mission is to advance the InfoSec industry. We do this through our award winning educational podcasts, leading pentest gear, and inclusive community - where all hackers belong.

Пікірлер: 77

  • @g1zmo85
    @g1zmo857 жыл бұрын

    I love Haktips and Threatwire, keep up the good work!

  • @himanshuparmar8728
    @himanshuparmar87287 жыл бұрын

    all you need to remember is just xvf zxvf jxvf to extract & just replace x with c to compress cvf tar zcvf bzip jcvf bz2

  • @killistan

    @killistan

    7 жыл бұрын

    for the modern tar implementaions (other than busybox tar), you can also just use the -a flag to compress based on the file extension acvf tar.gz acvf tar.bz2 acvf tar.xz and for extracting any kind of tarfile you can just use xvf (even with busybox)

  • @siriusfox
    @siriusfox7 жыл бұрын

    Finally, a good video I can send at my lab mates for how to use basic tools.

  • @frankschneider6156

    @frankschneider6156

    7 жыл бұрын

    +Luke Renaud Better teach them the usage of the man command, then they can help themselves, assuming they are capable of reading of course.

  • @siriusfox

    @siriusfox

    7 жыл бұрын

    I would, but English proficiency is not high among most of them.

  • @frankschneider6156

    @frankschneider6156

    7 жыл бұрын

    +Luke Renaud You can change the language, the man page will be displayed in, either by using the -L option of the man command followed by the code of the language, or by setting the LC_MESSAGES environment variable.

  • @fumfsmdb
    @fumfsmdb7 жыл бұрын

    Love this Linux tutorials so practical..!!! thank you

  • @Xeo183
    @Xeo1837 жыл бұрын

    "we show you everything in the terminal here... so first of some TERMINology..." Is this pun intended? :D

  • @chrisradtke
    @chrisradtke7 жыл бұрын

    in the video you state tar stands for tarball, going way back, it actually stands for tape archive, when we used tape drives for backups, fyi

  • @aortizc82

    @aortizc82

    7 жыл бұрын

    Chris Radtke tar stands for Tape Archive?

  • @chrisradtke

    @chrisradtke

    7 жыл бұрын

    originally, back in the day. Tape ARchive. it stores the data in a linear fashion, required for tape backup.

  • @bana2s

    @bana2s

    7 жыл бұрын

    Yep. "ar" was the original archiving program; "tar" was for creating a tape archive. It would usually be piped directly to the tape device. "cpio" (copy input to output) was also used to create tape archives. I'm old.

  • @TNsturmtcd
    @TNsturmtcd7 жыл бұрын

    can you make some tutorials about how to secure your linux and keep your O.s safe ?

  • @TheDisgruntledMechanic
    @TheDisgruntledMechanic7 жыл бұрын

    Thanks!

  • @lank_asif
    @lank_asif7 жыл бұрын

    Thank you!!

  • @QUIX2468
    @QUIX24687 жыл бұрын

    Shannon Morse spottet at GForce Startrek Bridge Crew trailer

  • @BurnabyAlex
    @BurnabyAlex7 жыл бұрын

    9:15 Tar stands for Tape Archive . Tarball comes from .tar

  • @Rickmakes
    @Rickmakes7 жыл бұрын

    Many systems will have versions of other commands to work directly with compressed files. For instance, your system might have "gzless" or "zless" which works like the command "less" but on gzipped files. Another example is "gzcat" or "zcat" version of "cat".

  • @killistan

    @killistan

    7 жыл бұрын

    On my system I have a bzcat but not a gzcat. Except I made myself a shellscript: #!/bin/sh cat $@ |gunzip I very rarely use it ;)

  • @dpxprhulc4xkl
    @dpxprhulc4xkl7 жыл бұрын

    Love your glasses!

  • @madsouris
    @madsouris7 жыл бұрын

    what is the best laptop for linux? cheap, acceptable speed and good battery?

  • @dell7013
    @dell70132 жыл бұрын

    can anyone explain why she used a backslash when using her first cd command? I've never seen that usage before

  • @isaak1904
    @isaak19047 жыл бұрын

    thanks

  • @anmac6910
    @anmac6910 Жыл бұрын

    I want to preserve file and folder timestamps from a network drive of my android internal storage. When I use winzip to compress whatsapp documents folder its saying its not found but clearly the file is there, the only thing is its without an extension. Why cant winzip archive it ?

  • @killistan
    @killistan7 жыл бұрын

    Generally, if you think you want bzip2 compression you actually want to use xz. bzip2 is slow, to compress, orders of magnitude slower than even xz to decompress, and xz almost always out-compresses it. Even gzip (very fast) can sometimes out-compress it, actually. So why is bzip2 still in use? It does really well at compressing really small text files. For instance, man pages are almost always bz2 compressed.

  • @SlideRSB
    @SlideRSB7 жыл бұрын

    Good tutorial as usual, Snubs! Why did you have to justify your use of the term "tack" for hyphen? Do you actually get people questioning you about that?

  • @hak5

    @hak5

    7 жыл бұрын

    lol yes. Anytime I do something that's not the norm, I have to justify it. -s

  • @NoEgg4u
    @NoEgg4u4 жыл бұрын

    .zip files are limited to 4 GB. Even if the file is 4.1 GB, and compression would bring it down to 3 GB, the zip will fail. If you have more than one file, and all are smaller than 4 GB, but combined they exceed 4 GB, then zip will fail. So if you are planning to zip us your videos, or your music collection, or any large volume of data, first check their combined byte size before commencing the job via "zip".

  • @geraldellis1177
    @geraldellis11777 жыл бұрын

    is there a lesson on permissions Shannon

  • @kd1s
    @kd1s7 жыл бұрын

    And what does tar stand for? Tape ARchive or tar. On and in my world it's tar -cvpf and -xvpf.

  • @jaredmeit6127
    @jaredmeit61277 жыл бұрын

    Now you need to show how to crack passwords on zip files!

  • @killistan
    @killistan7 жыл бұрын

    zip and gzip both use the "deflate" algorithm. hence "deflated" ;)

  • @chrismoore9997
    @chrismoore99977 жыл бұрын

    Here is one for you to tell us about. How do you use apt (or apt-get) to install software when the computer is not on a network? I can get to a network and download something on a USB drive or a CD, but the computer I need it on has no network access.

  • @pgbilbo

    @pgbilbo

    7 жыл бұрын

    Why dont you just download the .deb and dpkg -i it?

  • @chrismoore9997

    @chrismoore9997

    7 жыл бұрын

    If I knew about that, I wouldn't have been asking. How do I download a .deb ??

  • @killistan

    @killistan

    7 жыл бұрын

    apt-get download

  • @chrismoore9997

    @chrismoore9997

    7 жыл бұрын

    Well, that would work for my home computers that are Debian based, but the computer I have a problem with is a RedHat 7 (CentOS) system and it uses yum. It is on a air-gap network and I need to get a package.

  • @X.D.T.
    @X.D.T.7 жыл бұрын

    I really like dtrx ... for xtracting

  • @sanchezdot
    @sanchezdot7 жыл бұрын

    love

  • @jorgediaz6730
    @jorgediaz67307 жыл бұрын

    Cool

  • @malelonewolf80
    @malelonewolf807 жыл бұрын

    Linux terminal challenge: create a single terminal command-string (no script) that searches through multiple folders and subfolers for images and copies all of the image files into a singular folder (without the folder-structure) while also ensuring that no files are overwritten in the case that there are multiple imagefiles with the same name and all copied image files must be in a 8 by 3 character long filename. Each file must have a unique filename. I have researched this for a while (linux terminal newbie) and found a command-string that locates and copies images from many subfolders into a single folder without overwriting any files (backup parameter), but I am left with a bunch of backup-files (created to avoid overwriting images of similar filenames) in a 8 by 3 by 3 character long filename. Theese needs to be renamed to an 8 by 3 character format, but since it is the last 3 characters in the 8 by 3 by 3 character filename that makes each filename unique (that is numbered, i.e. n03), I need to move the numbering of the last 3 characters into the first 8 characters (i.e. an imagefile by the name pic04056.jpg.n03 needs to be renamed like thus n0304056.jpg). I am sure that this should be possible in the terminal, thus avoiding me the work of manually copy 5-6000 images into a single folder and renaming a good portion of those images.

  • @killistan

    @killistan

    7 жыл бұрын

    just write yourself a script, it'll be easier :P You should definitely be using the find command. If you really need a one liner, it's easier to start with a script that does what you want, than it is to build it on just one line.

  • @malelonewolf80

    @malelonewolf80

    7 жыл бұрын

    Easier yes, but my goal is to do it in one line without using scripts. Why, to see if it can be done and also to help me learn Linux terminal commands.

  • @killistan

    @killistan

    7 жыл бұрын

    There's a joke that you can install Gentoo Linux with a one liner, usually followed by one massive line containing all of the commands from the install handbook. You can usually take a script and combine its parts into a single line, making use of the ;semicolon. That's why I suggest starting there. I'm curious what programs you're using. This smells like something I'd consider python or perl for, because dealing with strings in sh or bash is painful. Unless you can avoid handling filenames as strings in variables, ie find . |while read filename; do echo "$filename"; done rather than filelist="$(find .)"; for filename in "$filelist"; do echo "$filename"; done change the echo "$filename" to echo $(echo "$filename") and you might see why ;)

  • @malelonewolf80

    @malelonewolf80

    7 жыл бұрын

    I am simply using the find command and piping the results into a copy command which also creates backup of duplucate filenames using a numbering argument. I have not the exact command-string in front of me now so I cannot be spesific, but in the testrun I have done it seems to work okey, but it creates filenames in an 8 by 3 by 3 character format (The numbered backup files) which Windows do not recognize. I am thinking about having xargs or exec and the end of the command string and thereafter using a sequencing command (seq, I believe) to place a unique number in the first characters of the 8 character bit of the filename and thereafter removing the last 3 unwanted numbered part of the filename. Should end with filenames such as 00010506.jpg rather than Dsc00506.jpg.n01. But that is as far as I have come so far. Then my next challenge would be to find a command string to search and remove duplicates on an exact bit-by-bit level rather than comparing filenames and removing similar filenames.

  • @killistan

    @killistan

    7 жыл бұрын

    you might look at awk for the rename a very naive approach: echo 00010506.jpg.n01 |awk -F '.jpg' '{print $1 $2 ".jpg"}' gives you 00010506.n01.jpg if that's what you wanted. -F is "field separator," so instead of its default ' ', it can be made ".jpg" '{print $1 $2}' then prints everything except the separator, and you can just put ".jpg" on the end. You'd have to find something more fancy if your filenames have more than one .jpg in them. removing duplicate checksums? md5sum is probably the quickest way to get a checksum. And |sort |uniq -D to get you the duplicate checksums. At this point you'll probably want to google something like "how to print everything but the first item with awk" ;)

  • @ayan.debnath
    @ayan.debnath7 жыл бұрын

    why J? :P

  • @xcheese1
    @xcheese17 жыл бұрын

    xz is pretty much always preferable to bzip2. Slower compression, but better compression and faster decompression.

  • @killistan

    @killistan

    7 жыл бұрын

    also vanilla xz can do multithreaded compression: xz -T 0 # where -T is the number of threads, 0 means "as many as there are logical cpu cores" I have an alias xztar='tar --use-compress-program "xz -T0 -v"'

  • @xcheese1

    @xcheese1

    7 жыл бұрын

    +killistan: Thanks for the tip! XZ FAN THREAD

  • @killistan

    @killistan

    7 жыл бұрын

    :) I have another alias: gztar='tar --use-compress-program "pigz"' That one I use with the -p (--preserve permissions) option when I'm moving partitions around, to make sure I don't lose anything ;)

  • @vcsoyt
    @vcsoyt7 жыл бұрын

    unzip -c???? why?

  • @islam_lov
    @islam_lov7 жыл бұрын

    how to crack phone password with Kali Linux.

  • @islam_lov

    @islam_lov

    7 жыл бұрын

    you can now.

  • @imisinjan
    @imisinjan7 жыл бұрын

    I could sware that it was Miley Cirus at the end Ya'll

  • @shihaamAbdulRahman
    @shihaamAbdulRahman7 жыл бұрын

    If its a virus that you zipped anti virus can scan and delete it, but if you have a password set anti virus cant scan the file; Great for virus archiving.

  • @killistan

    @killistan

    7 жыл бұрын

    Yeah, I have some encrypted zip files used by a malware installer to hide from antivirus, from a computer someone had me look at. If your antivirus doesn't warn you about encrypted zip files it's doing you a disservice by claiming they are 'clean'. I haven't gotten around to figuring out a way to decrypt them that won't take 8 days. Guess I'm waiting for the HakTip video ;) I also really hate when antivirus deletes programs rather than putting them in a quarantine. I kinda like to try to figure out what's in the files, you know?

  • @Alperenkitapc
    @Alperenkitapc7 жыл бұрын

    We don't talk about tar here.

  • @jimbob5188

    @jimbob5188

    7 жыл бұрын

    The name of tar is not spoken in my circles too, its known as the shameful one.

  • @mr_mr

    @mr_mr

    7 жыл бұрын

    damn it.. you spoke of the unspoken. Now we're all screwed.

  • @imisinjan
    @imisinjan7 жыл бұрын

    Terminal terminology I saw what you did there Shannon lol

  • @mittyma6015
    @mittyma60155 жыл бұрын

    Very good video, but you go to fast

  • @rickgaine3476
    @rickgaine34767 жыл бұрын

    Tar, does not stand for Tarble. It stands for tape archive.

  • @user-md3is4dq2d
    @user-md3is4dq2d7 жыл бұрын

    i thought hacktip died

  • @llcooljay66
    @llcooljay667 жыл бұрын

    Instead of going over basic stuff all the time show how to exploit zip passwords or exploit SSH sessions.

  • @ShannonMorse

    @ShannonMorse

    7 жыл бұрын

    Jay Johnston lots of schools use our HakTip show for their classrooms (hi guys!). But I will, eventually. Just feel the need to cover the easy stuff first, or the more advanced stuff won't make much sense.

  • @PacoOtaktay

    @PacoOtaktay

    7 жыл бұрын

    Shannon Morse, I agree with you on this. You do need to start at the beginning so the more advanced stuff makes more sense. I know there are some of us that would love to know how to do the advanced stuff now, but even I have learned things I have missed. :) Linux has a large supply of commands that could take years to go over lol.

  • @cntrix2047
    @cntrix20477 жыл бұрын

    last

  • @piiumlkj6497
    @piiumlkj64977 жыл бұрын

    7 th ... hhh

  • @UnknownYTx
    @UnknownYTx7 жыл бұрын

    First

  • @arlecchinosec7728
    @arlecchinosec77287 жыл бұрын

    you have a cute face :3

  • @mallock8529
    @mallock85294 жыл бұрын

    Majority of the video is zip instead of gzip or bzip... officially Microsoft propaganda.

Келесі