How to Archive Important Data in Linux, Best Linux Courses Yerevan

How to Archive Important Data in Linux, Best Linux Courses Yerevan

Articles

Let's say you have a server that regularly backs up data. Of course, it's best to store backups in archive format. Firstly, it's easier to handle them this way - as a separate file. Secondly, compressed data takes up less space on your hard drive. Today we'll tell you how to archive files and folders in Linux, this knowledge is included in best Linux courses Yerevan.

Command for archiving files in Linux, best Linux courses Yerevan

Before anything else, let's figure out what command is used to archive in UNIX and Linux. The utility is intended for this purpose tar (From the English. Tape archive), called by the command of the same name. More details about the history of its origin back in the days of magnetic tapes will be told by Astra Linux special course Yerevan. Which will also significantly simplify the search for work in IT in Armenia in 2023.

The syntax of the command is quite simple, after which you should specify a set of options corresponding to the required operation:

  • -c — create an archive;
  • -f — specify the file with which the operation needs to be performed;
  • -t — view the contents of the archive;
  • -v — output a detailed report on all operations performed;
  • -x — extract the contents of the archive.

After the options, you should specify arguments, which can be from one to several. The specific number depends on what operation you decide to perform. For example, if you want to view the contents of an archive, the options will be enough -tf (-tvf in this case will show not just a list of files, but also their attributes) and one argument. And if you want to archive the selected file - after the options -cf add two arguments:

  • first - the name that should be given to the new archive (not forgetting the extension *.tar);
  • then - the name of the file added to the archive or the path to it (absolute or relative).

It is worth noting that all additional arguments after the second will also be considered files that should be added to the archive. To better understand this topic, we recommend going through introductory course on Linux administration Yerevan. Which is available to everyone in Armenia in an online format on the platform SEDICOMM University.

How to compress an archive so it takes up less space in Linux

It is worth noting that by default tar utility does not compress the archived data. It only creates an archive file from it. However, in many cases you will want to use compression. For example, so that your backups take up less space on the server's disk drive. Or so that the archive is uploaded to the cloud and downloaded from there faster. For such cases, the command options are intended tar, using third-party utilities for data compression/decompression:

  • -z — for compression by the utility gunzip (gzip);
  • -j — for compression by the utility bzip2;
  • -J — for compression by the utility xz.

These three programs are mainly used by Linux users to compress files. More details about the compression capabilities of these utilities will be told Red Hat Enterprise Linux Administration Training Course Yerevan.

Of course, such knowledge will be useful both for confident use of the OS for personal purposes. And in work for solving real problems in the field of system administration. Moreover, today in many areas of the information technology sector we have to deal with Linux. Therefore, we recommend taking courses on the platform SEDICOMM Universityto lay the foundation for your comprehensive IT education.

Our team SEDICOMM University: Cisco Academy, Linux Professional Institute, Python Institute.