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

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ค. 2017
  • 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! th-cam.com/users/timedtext_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
    @g1zmo85 7 ปีที่แล้ว

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

  • @himanshuparmar8728
    @himanshuparmar8728 7 ปีที่แล้ว +8

    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 ปีที่แล้ว +3

      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
    @siriusfox 7 ปีที่แล้ว +1

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

    • @frankschneider6156
      @frankschneider6156 7 ปีที่แล้ว +1

      +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
    @fumfsmdb 7 ปีที่แล้ว

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

  • @TNsturmtcd
    @TNsturmtcd 7 ปีที่แล้ว +4

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

  • @chrisradtke
    @chrisradtke 7 ปีที่แล้ว +24

    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 ปีที่แล้ว +2

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

    • @bana2s
      @bana2s 7 ปีที่แล้ว +4

      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.

  • @madsouris
    @madsouris 7 ปีที่แล้ว

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

  • @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 ?

  • @dell7013
    @dell7013 2 ปีที่แล้ว

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

  • @Xeo183
    @Xeo183 7 ปีที่แล้ว +4

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

  • @geraldellis1177
    @geraldellis1177 7 ปีที่แล้ว

    is there a lesson on permissions Shannon

  • @Rickmakes
    @Rickmakes 7 ปีที่แล้ว

    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
    @dpxprhulc4xkl 7 ปีที่แล้ว

    Love your glasses!

  • @lank_asif
    @lank_asif 7 ปีที่แล้ว

    Thank you!!

  • @TheDisgruntledMechanic
    @TheDisgruntledMechanic 7 ปีที่แล้ว

    Thanks!

  • @BurnabyAlex
    @BurnabyAlex 7 ปีที่แล้ว +2

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

  • @QUIX2468
    @QUIX2468 7 ปีที่แล้ว

    Shannon Morse spottet at GForce Startrek Bridge Crew trailer

  • @SlideRSB
    @SlideRSB 7 ปีที่แล้ว

    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

  • @chrismoore9997
    @chrismoore9997 7 ปีที่แล้ว

    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.

  • @isaak1904
    @isaak1904 7 ปีที่แล้ว

    thanks

  • @kd1s
    @kd1s 7 ปีที่แล้ว

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

  • @killistan
    @killistan 7 ปีที่แล้ว

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

  • @killistan
    @killistan 7 ปีที่แล้ว

    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.

  • @sanchezdot
    @sanchezdot 7 ปีที่แล้ว

    love

  • @jaredmeit6127
    @jaredmeit6127 7 ปีที่แล้ว +1

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

  • @jorgediaz6730
    @jorgediaz6730 7 ปีที่แล้ว

    Cool

  • @ayan.debnath
    @ayan.debnath 7 ปีที่แล้ว

    why J? :P

  • @vcsoyt
    @vcsoyt 7 ปีที่แล้ว

    unzip -c????
    why?

  • @X.D.T.
    @X.D.T. 7 ปีที่แล้ว

    I really like dtrx ... for xtracting

  • @NoEgg4u
    @NoEgg4u 4 ปีที่แล้ว

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

  • @islam_lov
    @islam_lov 7 ปีที่แล้ว +1

    how to crack phone password with Kali Linux.

    • @islam_lov
      @islam_lov 7 ปีที่แล้ว +1

      you can now.

  • @xcheese1
    @xcheese1 7 ปีที่แล้ว

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

    • @killistan
      @killistan 7 ปีที่แล้ว +1

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

  • @malelonewolf80
    @malelonewolf80 7 ปีที่แล้ว

    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" ;)

  • @imisinjan
    @imisinjan 7 ปีที่แล้ว

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

  • @Alperenkitapc
    @Alperenkitapc 7 ปีที่แล้ว +3

    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.

  • @shihaamAbdulRahman
    @shihaamAbdulRahman 7 ปีที่แล้ว

    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?

  • @imisinjan
    @imisinjan 7 ปีที่แล้ว +1

    Terminal terminology I saw what you did there Shannon lol

  • @mittyma6015
    @mittyma6015 5 ปีที่แล้ว

    Very good video, but you go to fast

  • @rickgaine3476
    @rickgaine3476 7 ปีที่แล้ว +2

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

  • @cntrix2047
    @cntrix2047 7 ปีที่แล้ว +2

    last

  • @piiumlkj6497
    @piiumlkj6497 7 ปีที่แล้ว

    7 th ... hhh

  • @user-md3is4dq2d
    @user-md3is4dq2d 7 ปีที่แล้ว

    i thought hacktip died

  • @llcooljay66
    @llcooljay66 7 ปีที่แล้ว +5

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

    • @ShannonMorse
      @ShannonMorse 7 ปีที่แล้ว +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.

  • @UnknownYTx
    @UnknownYTx 7 ปีที่แล้ว

    First

  • @arlecchinosec7728
    @arlecchinosec7728 7 ปีที่แล้ว

    you have a cute face :3

  • @mallock8529
    @mallock8529 4 ปีที่แล้ว

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