Archiving and Compression on Linux - Basic tar Commands

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 91

  • @tutoriaLinux
    @tutoriaLinux  4 роки тому +5

    # Table of Contents: #
    ################
    Compression + Archiving: 04:25
    Decompression: 07:01
    Don't do this: 09:34
    Examples (Wordpress vs. Joomla): 12:19
    Explanation of 'tar' options: 14:33

  • @theGreenDuckie
    @theGreenDuckie 5 років тому +21

    I've read a nice article some time ago on how to make this more memorable. tar -czf(compress ze files) and tar -xzf(extract ze files). Great videos buddy and thank you for investing the time and effort in making these

    • @garretmkiii
      @garretmkiii 4 роки тому +1

      Compress ze files! but I'm le tired...

  • @samuraijack5919
    @samuraijack5919 4 роки тому +6

    I wanted to tell you that your method of explaining things is incredibly well done and give me confidence.
    I am currently looking to get into Fullstack Web Development and part of learning that is learning BASH and GIT.
    When I started coding again, I would get so frustrated on wrapping my head around concepts and problem solving. It nearly convinced me that I should just give up and stay with my Tier 1 support job.
    Then I started breaking my study sessions with one of your videos and taking notes on it. I don't know why, but you break down these concepts in a way that makes it seem so laid back and easy to understand. I get so much hope with watching your videos.
    I love watching your stuff, it makes me believe that moving into my new career won't be as rough as I initially feared it would be.
    Thank you again Dave.

    • @tutoriaLinux
      @tutoriaLinux  4 роки тому +2

      Thanks, I really appreciate that. I've been following your notes as you post them and know for a fact that you are going to have this stuff down when the time for interviews etc. comes. Keep playing around with this stuff and do some practical projects (host a website, mess around with web development; whatever!). Don't wait too long to start interviewing. If you're not bombing the first few interviews, you waited too long to try. You got this!

  • @stendall
    @stendall 6 років тому +6

    Best thing about you mate, you give me something to hook all these facts onto. Ie, you talk about where it comes from. Tar = archiving and compression, they're not the same thing, and here's where it comes from, and some background about ftp...that is what people need in order to learn and retain knowledge. Most people aren't rainman, they can't just read an entire manual of dry technical data and then know how to use something.
    So thank you and bravo, this is what I need, and I think, what a lot of people need.

  • @SUNNySINGh-if6jd
    @SUNNySINGh-if6jd 5 років тому +4

    It's 2019 and your videos are inspiring next generation like me thanks bro very much love from india

  • @archangeltemjin69
    @archangeltemjin69 5 років тому +2

    I'm grateful that you've covered a two-part tmux video session, on my previous job, I've just used tmux to avoid being disconnected during the execution of the ansible script, but you've taught us here the great power of tmux. Thank you so much, man.

  • @pankajkharade6936
    @pankajkharade6936 4 роки тому

    you are really the best teacher for Unix

  • @croadjar
    @croadjar 8 років тому +1

    I already know pretty much everything in your video's, but I still enjoy watching them. Keep up the good work!

  • @tektauron
    @tektauron 2 роки тому

    Today precisely marks 6 years since this video was uploaded, and it's just as useful. THANK YOU SO MUCH!

    • @tutoriaLinux
      @tutoriaLinux  2 роки тому +1

      Hah, thanks. I imagine it will last another 6 years!

    • @tektauron
      @tektauron 2 роки тому

      @@tutoriaLinux hahaha! Most likely :D

  • @jthomas3584
    @jthomas3584 7 років тому +38

    The tarbomb bit got me wondering what would happen if the tarbomb had a file called file.txt and you already had a file in the directory you was extracting into with the same name. Turns out it overwrites it! :O

    • @tutoriaLinux
      @tutoriaLinux  7 років тому +45

      I love this -- you weren't sure how something would behave, so you tested it for yourself to find the answer. *Almost no one does this,* but it's one of the ways that you can guarantee that you'll actually retain that practical knowledge. Just wanted to thank you for doing that, and then posting the answer here for others to benefit from. You rock!

    • @jthomas3584
      @jthomas3584 7 років тому +5

      Ah thanks, right back at ya. FYI I bought your udemy course, keep up the awesome work!

    • @RPBCACUEAIIBH
      @RPBCACUEAIIBH 7 років тому +2

      Yeah that scenario sucks... I was thinking it's easy to clean up with a script that unpacks the tarbomb safely, and deletes all the shrapnel, looping trough the file list, but that still wouldn't recover you your file... that's why you really need to have backup...

    • @teknastyk
      @teknastyk 5 років тому +2

      @@tutoriaLinux 20 years ago I did exactly the same thing with a win95 CD; when my dads windows 95 wouldn't boot... Fast forward 20 years Im studying linux&bsd bc networking was not enough. Learning by doing is realy the only way in IT i guess XD

  • @cswann8
    @cswann8 8 років тому +29

    I totally LOL'd at the "naughty_sites.txt" My list of adult content is slightly less conspicuous.

    • @tutoriaLinux
      @tutoriaLinux  8 років тому +10

      People like you are the reason I do this :-D.

    • @allynbarnes702
      @allynbarnes702 6 років тому

      it just got me REAL damn curious...
      lmao

    • @EnderCrypt
      @EnderCrypt 6 років тому +3

      not_naughty_sites_TOP_SECRET_PLS_NO_OPEN.txt

    • @performancefuel8834
      @performancefuel8834 5 років тому

      Nice files ;-)

  • @rybyzdvora3994
    @rybyzdvora3994 Рік тому

    I am not english native speaker but I can understand your lessons well. So thanks.

  • @jimkats1
    @jimkats1 6 років тому +1

    Great video. I recently started watching your playlist of beginner sysadmin tutorials, to improve my knowledge of basic Linux usage and so far I learnt some basic stuff I didn't know. Now I'm coming closer in knowledge to a friend of mine who works as junior sysadmin :D.
    So, for this video, another useful thing you could explain is how to view the content of an archive file without extracting it. I didn't know how to do it, so I tested and found this:
    tar -tf test.tar.gz (this will list all the files with their relative path)
    tar -tvf test.tar.gz (this will list all the files in the same way as running ls -l)

  • @zsahe21
    @zsahe21 6 років тому

    Videos are only getting better!

  • @LikitheWeerasinghe
    @LikitheWeerasinghe 8 років тому

    Very helpful set of commands. I shall try this from now on. Thanks a ton.

  • @burdenedhelm9614
    @burdenedhelm9614 3 роки тому

    Very informative and cool! Thank you!

  • @samuraijack5919
    @samuraijack5919 4 роки тому +6

    Archiving and Compression on Linux - Basic tar Commands
    My Notes:
    What is the tar command?
    It stands for tap archive. (it is an archiving utility)
    - from the 1970s, like disco
    -
    What is archiving?
    The process of taking all the files & directories on a system and making a single file that contains them all.
    - creating one logical file out of all
    -
    What is compression?
    Using algorithms to look for repeating patterns inside files & save the space
    - can be then expanded back to those files on the other side
    - making files smaller
    (more simple a pattern, the more space you can save)
    -
    FTP is...
    NOT your friend
    -
    What is this command doing:
    tar -zcvf docs.tar.gz Documents/
    Archiving and Compressing with tar
    'f' will specify the filename for the directory (docs.tar.gz in this case)
    'v' is verbose, means that we will get one line of output for each file we are compressing
    'c' is for create, we are creating a new archive
    'z' is for zipping (we are using the g zip program), used to compress archive as well as archiving it
    -
    What is this command doing:
    tar -zxf docs.tar.gz
    Unzips a tar directory HERE (in this location)
    'z' shows that it is g zipped
    'x' means to extract it
    'f' defines the archive filename (in this case: docs.tar.gz)
    -
    What is a tar bomb?
    NOTHING IS CONTAINED
    A directory that is compressed as if you were sitting in the directory. It blows up in your face and scatters files/directories all over.
    Try to compress files from outside a directory (one directory above)
    -
    When should you create a tar bomb?
    Never ever ever ever ever ever ever Ever EVER create a tar bomb.
    (or when you don't like your new Junior Sysadmin)
    -
    When you extract a directory, what should you do before you extract it?
    Create a new directory and move inside that BEFORE EXTRACTION.
    (if you extract a tar bomb, it will be contained inside the folder)
    -
    Tell me if there is anything I missed. Please be safe and have a great day.

  • @farzinfaridfar1580
    @farzinfaridfar1580 4 роки тому

    Thanks to your explanation, I will finally be able to remember the tar commands without a brain CPU spike!!

  • @Alexbl100
    @Alexbl100 3 роки тому +2

    The tar bomb thing used to be an issue for me as well. I worked with wordpress and every plugin I extract is almost never a tar bomb or a zip bomb (this can happen with zip too) while every zip file I got from my clients was a tar bomb so I just kinda learned to make a container myself first then extract. Just a way to stay safe.

  • @fairchild9able
    @fairchild9able 6 років тому +1

    Super great series Dave! Thank you. You mentioned ftp and have touched on various protocols in the series. can you recommend a video series on the relevant ones for a budding penetration tester that has the same vibe as yours?

    • @tutoriaLinux
      @tutoriaLinux  6 років тому +1

      I haven't come across any, but I haven't been looking hard. Let me know if you find a channel like that!

  • @anubandhu08
    @anubandhu08 8 років тому

    Nice way to explain.. sound is neat and clean

    • @abogadojon
      @abogadojon 3 роки тому

      Except when his voice trails off (loses audible volume) at the conclusion of a sentence. Mr Dave does that three times in this video. Difficult for the older, hard-of-hearing person to understand. You'll be here.

  • @unstoppable-ar3292
    @unstoppable-ar3292 4 роки тому +1

    thank you man.

  • @majdibentej346
    @majdibentej346 4 роки тому

    Very helpful... thanks!!

  • @bh4t128
    @bh4t128 8 років тому +1

    thanks so much ur the best boss

  • @vindent
    @vindent 8 років тому +1

    Thank you for the video

  • @marcelocarnauba3933
    @marcelocarnauba3933 3 роки тому

    Nice tarbomb tip! Thank you!

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.

  • @hello55125
    @hello55125 4 роки тому

    Great video

  • @peter9910
    @peter9910 Рік тому

    Gotta love that cmatrix command 😂

  • @asaskald
    @asaskald 3 роки тому

    Here's how I remember them: -c(create) -v(verbose) -j(compress to bzip2) -f(file name). So example: tar -cvjf foo.tar.bzip2 foo{1,2,3,4,5,6,7}.txt

  • @thingsiplay
    @thingsiplay 3 роки тому +1

    Another annoying thing is, when using full paths to create. Extracting those files will extract the full path...

  • @stealthsloth
    @stealthsloth 4 роки тому

    How do you get the colors in your terminal that you have? Is it just a custom setup or is it a theme that can be downloaded in Ubuntu?

  • @GaryMcNeely
    @GaryMcNeely 5 років тому

    good video

  • @ahmadel-komey8977
    @ahmadel-komey8977 6 років тому +1

    Thank you for the tutorial.
    I was wondering how did you get the shell to ignore case on suggestion? I mean, you type "d", hit tab and it suggests both "decompression_chamber" and "Desktop". AFAIK, linux shell is case sensitive.
    I appreciate what you are doing here man.

  • @olbluelips
    @olbluelips 7 років тому +1

    lzma compression is great

  • @EveDaya
    @EveDaya 8 років тому +1

    Thank youu so much, I subscribe at once :)

  • @kojoig
    @kojoig 8 років тому

    Thanks a lot.

  • @ryanwatson6356
    @ryanwatson6356 8 років тому

    Thanks

  • @drewmj70
    @drewmj70 4 роки тому

    You used to have to pipe the tar file through gzip to get compression.

  • @thanhavictus
    @thanhavictus 4 роки тому

    is there any point to using gunzip and gzip if tar already exists

  • @michelverbel8108
    @michelverbel8108 4 роки тому

    Why do you need -z if you're extracting? is gzip extracting or tar?

  • @willrun4fun
    @willrun4fun 8 років тому +1

    What shell are you using?

    • @tutoriaLinux
      @tutoriaLinux  8 років тому +1

      +Andy Rhine ZSH (the Z shell), along with oh-my-zsh (check on github).

  • @Nezarus0
    @Nezarus0 7 років тому +1

    You can leave out the z when unarchiving, as tar will auto decompress these days.

  • @chinnichinni6285
    @chinnichinni6285 7 років тому

    I'm not able see decompression_chamber directory how can i extract

    • @Nezarus0
      @Nezarus0 7 років тому

      chinni chinni that was just a directory Dave created to demonstrate extracting the archive. He named it with his typical sense of humour.
      In other words, you can run tar commands anywhere, but it is often nice to stick a bunch of related tars in a directory somewhere before unpacking them.

  • @husseinmahmoud6262
    @husseinmahmoud6262 6 років тому

    Hi thanks for your help when i try to use Tar command i get this error
    tar: Removing leading `/' from member names
    tar: /Demo: Cannot stat: No such file or directory
    tar: Exiting with failure status due to previous errors
    i don,t know what is the wrong with that

    • @husseinmahmoud6262
      @husseinmahmoud6262 6 років тому

      i get the solution for this problem if you face this message it means you must change the owner of the file or folder and then try to use the Tar command and it will work without any problem

  • @sohamgumaste
    @sohamgumaste 8 років тому

    How do you get that pretty looking terminal?

    • @tutoriaLinux
      @tutoriaLinux  8 років тому +1

      +Soham Gumaste I use i3 as my window manager on all my work machines, along with ZSH (the Z shell). Search for oh-my-zsh to get started :-).

    • @sohamgumaste
      @sohamgumaste 8 років тому

      tutoriaLinux Thanks for the reply!

  • @DaveSomething
    @DaveSomething 4 роки тому

    yay, I'm like #1000

  • @Flankymanga
    @Flankymanga 7 років тому

    I guess you can tell tar to extract to a specific folder explicitly?

    • @tutoriaLinux
      @tutoriaLinux  7 років тому

      I believe it's the -C option (create): linuxcommand.org/man_pages/tar1.html

  • @limpep
    @limpep 8 років тому

    Is it possible to view the content of a archive before decompressing it?

    • @tutoriaLinux
      @tutoriaLinux  8 років тому

      +limpep Sure: tar -ztvf file.tar.gz -- make sure to check out the manpage and Google around for what you want; tar can do a million things.

    • @limpep
      @limpep 8 років тому

      +tutoriaLinux Thanks tar -tf seems to do the trick.

  • @mate123bur
    @mate123bur 6 років тому

    how do you tree your directory.. I don't have that command

    • @tutoriaLinux
      @tutoriaLinux  6 років тому

      It's usually not installed by default. Just install tree and you should be good to go.

    • @mate123bur
      @mate123bur 6 років тому

      I tried this, but it doesn't seem to work. I am running linux on my mac and a $ sign appears after my name. I think this requires a different installation type... any thoughts?

    • @somber_soul
      @somber_soul 6 років тому

      @@mate123burYou have to run it through sudo.

  • @vrl.
    @vrl. 3 роки тому

    XKCD brought me here.

  • @horatioh5469
    @horatioh5469 7 років тому

    very well done my friend..can 'like' and 'subscribe' but I can't stand fakebook or twitter I'm afraid..

  • @gjermundification
    @gjermundification 8 років тому

    tar -Jcvf docs.txz ~/Documents
    tar -Jxvf docs.txz

  • @nagiostest2460
    @nagiostest2460 6 років тому

    I love that joke :)

  • @jenishSakhiya
    @jenishSakhiya 6 років тому

    I'd be like `cat /home/dave/Documents/importantdocs/naughty_sites.txt` or hopefully `cat /home/dave/Documents/importantdocs/naughty_sites.txt | less`

  • @josephrivera674
    @josephrivera674 5 років тому

    How to have that matrix screensaver? hahahaha

  • @sivadasrajan
    @sivadasrajan 4 роки тому

    me who only knows tar -xf
    i can disarm the bomb

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 5 років тому +1

    Pretty sure somewhere deep in that tar man page there must be a flag for "extract to xx folder" to avoid that tar bomb like situations.