Efficient File Management on SiteBay Hosting with Command Line Tools
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
to try this guide for free.
Utilizing tar and gzip commands, you can streamline file management within your SiteBay WordPress hosting environment. These tools allow you to compile multiple files into a single archive and compress them to reduce disk space usage. While tar groups files together, gzip minimizes the archive’s size. Together, they produce a compressed file, often referred to as a “tarball”, with the .tar.gz extension.
Archive a Directory
Create a directory in your SiteBay environment and add a file: mkdir myfolder && touch myfolder/sample.txt
Archive the directory using tar: tar -cvf myfolder.tar myfolder/
Verify the creation of the archived file: ls
myfolder myfolder.tar
Compression with gzip
Compress the archived file with gzip:
gzip myfolder.tar
The presence of a new file should be confirmed: ls
myfolder myfolder.tar.gz
Observing the file sizes, the compressed archive (myfolder.tar.gz) occupies less disk space: ls -l –block-size=KB
total 8kB
drwxrwxr-x 2 sitebay sitebay 4kB Jan 30 13:13 myfolder
-rw-rw-r-- 1 sitebay sitebay 2kB Jan 30 13:29 myfolder.tar.gz
Extracting a Tarball
Extract the directory and its contents:
tar -xzvf myfolder.tar.gz
myfolder/
myfolder/sample.txt
Explanation of the flags used:
-c: Creates a new archive. -v: Verbose mode, displays the process output. -z: Utilizes gzip for compression or decompression. -x: Extracts files from the archive. -f: Specifies the filename of the archive. Additional tar Command Options
Here are more flags that enhance tar usage:
Flag Function -A Appends tar files to an existing archive. -d Displays differences between an archive and the filesystem. -delete Removes files from the archive. -r Adds files to the end of an archive. -t Lists the contents of an archive. -u Updates the archive, avoiding overwrites.
For comprehensive information on these and other options, consult the manual pages with man tar. This guide equips you with basic knowledge for managing archives and compressed files within your SiteBay WordPress hosting setup, using the command line for efficient file handling.
This page was originally published on