At immoderate constituent successful your Linux journey, you'll request to beryllium capable to compress and decompress a folder from the bid line. Jack Wallen shows you how.
The Linux bid enactment is an incredibly almighty tool. From the CLI there's adjacent to thing you can't do. And though a GUI mightiness marque immoderate of the tasks a spot easier, the simplicity of doing your enactment successful a terminal model is astir arsenic elegant a solution arsenic you'll find.
SEE: 5 Linux server distributions you should beryllium using (TechRepublic Premium)
Take, for instance, the task of compressing a folder. Sure, you could unfastened a record manager, right-click a folder, and prime Compress. But what if you're connected a headless server? A Linux without a GUI isn't going to connection you a point-and-click affair. So what bash you do?
You crook to the tar command, which makes abbreviated shrift of converting folders into compressed files.
Let maine amusement you however this is done. Let's accidental you person a folder named TEST and you privation to compress it into a azygous record truthful you tin much easy nonstop it to idiosyncratic oregon prevention it arsenic a backup. To bash this, log into your Linux instrumentality and alteration into the directory lodging the TEST folder.
The bid we'll tally is tar -zcvf TEST.tar.gz TEST.
The options we utilized are z (for compress), c (for create), v (for verbose output), and f (for force).
After moving the command, you'll find the recently created TEST.tar.gz. The tar information of the hold means the record is simply a tar archive and the gz indicates it's been compressed.
You could past decompress that caller record with the bid tar -xvzf TEST.tar.gz.
If you wanted to presumption the files wrong that archive (without decompressing and extracting), you could contented the communal tar -ztvf TEST.tar.gz and tar would database retired the contents for you.
And that's beauteous overmuch each you person to bash to compress a folder from the bid enactment with tar.
Open Source Weekly Newsletter
You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered TuesdaysSign up today
- Linux 101: Demystifying the Linux directory structure (TechRepublic)
- Linux 101: How to find thrust abstraction usage from the bid line (TechRepublic)
- How to go a developer: A cheat sheet (TechRepublic)
- Kubernetes: A cheat expanse (free PDF)(TechRepublic)
- Could Microsoft beryllium en way to dumping Windows successful favour of Linux? (TechRepublic)
- A usher to The Open Source Index and GitHub projects checklist (TechRepublic Premium)
- How unfastened source-software transformed the concern world (ZDNet)
- Linux, Android, and much unfastened root tech coverage (TechRepublic connected Flipboard)