Author: author_sujit

12 tar command examples in Linux/Unix

The tar (Tape ARchive) tool is the most used archiving tool in Linux world. We already covered some of the compressing tools like zip/unzip, gzip/gunzip, and bzip examples which most of the time accompany this tar command. In this post, we will see on how to use tar command with simple examples. Note: TAR is not an compressing tool, but use above mention compressing tools to archive that. Syntax for Linux tar command tar [options] [TarName] [File/Directory] Tar Usage with Examples The tar command gets its name from the fact that it stores and extracts files from tape/disk archives. The tar creates the tarball with .tar extension used to take backup of the files/directories on to a tape archive by default. This just convert all the files and folders into single tar archive for easy storage and transfer. Let us see some examples of ‘tar’ usage to understand it better. Note: ‘tar’ by default produces the uncompressed tar-ball with only ‘.tar’ extension to a file. Example 1: Create a tape archive.  Create a basic tape archive from the tar command. With below example we are going to club all the files/folders in default folder. [email protected]:~$ ls default [email protected]:~$ tar -cvf default.tar default/ default/ default/bootlogd default/nss default/whoopsie default/rsync default/ssh default/puppetqd default/cron default/rsyslog default/apache2 default/grub default/rcS default/locale default/ufw [email protected]:~$ ls default default.tar We archived the default directory in the above example, options cvf are...

Read More

9 bzip and bunzip command examples in Linux/Unix

Different compression commands use a different type of compression algorithms. Similarly, bzip2 uses Burrows-Wheeler block sorting text compression algorithm along with Huffman coding. We already covered below similar commands 13 Zip and Unzip command examples in Linux/Unix 7 Linux/Unix gzip and gunzip command examples In this post, we will see how to use the bzip2 command. Syntax for bzip2 command in Linux bzip2 [OPTIONS] [FILENAME] The bzip2 command compresses the files to their corresponding bzip2 file, by default replacing the original file by original_name.bz2. The compressed files retain the permissions, modification date and ownership of the original files, when possible.   Note: bzip has a perfect compression ratio. Hence it is efficiently used to compress the backup files like tar to disk management. Example 1: To compress a single file within a directory. To remind again, this will replace the original file. [email protected]:~/default$ ls -l apac* -rw-r--r-- 1 sujit sujit 637 Mar 27 13:45 apache2 [email protected]:~/default$ bzip2 apache2 [email protected]:~/default$ ls -l apac* -rw-r--r-- 1 sujit sujit 407 Mar 27 13:45 apache2.bz2 Example 2: Though the compressed file usually will have a format of original_name.bz2, but we can provide a custom name for our compressed file by using ‘-c’ option. [email protected]:~/default$ bzip2 -kvc apache2 > apac.bz2 apache2: 1.565:1, 5.111 bit's/byte, 36.11% saved, 637 in, 407 out. [email protected]:~/default$ ls -l apac* -rw-rw-r-- 1 sujit sujit 407 Mar 27 15:55 apac.bz2 -rw-r--r--...

Read More

12 rsync commands examples in Linux/Unix

Rsync(Remote Sync) is one of the most efficient and secure data copying tool in Linux and Unix world. Rather than just copying, it can be called as synchronization tool. Whenever rsync is used to copy the files, it does it like a copy for the first time, but during its successive iterations, it will synchronize the files by just copying the delta change between them by using the remote-update protocol. And this synchronization can be either between the files on the local system or on the local system and remote system. Mainly between the local and the remote, as rsync generally termed for “Remote Synchronization”. NOTE: The rsync command cannot be used to copy the files between the two remote systems. Either you can copy data from local machine to remote machine or remote machine to a local one. In this post, we will see some examples of rsync along with some rarely known options that work wonders in the Linux data administration. Linux/Unix command syntax for ‘rsync’ rsync [options] [SRC] [DEST] Rsync can be used either in the push mode or a pull mode when the remote system is in scope. The basic syntax would remain same: For pushing the files to a remote system using Rsync rsync [options] [SRC] [email protected]:[DEST] Pulling the files from the remote system using rsync rsync [options] [email protected]:[SRC] [DEST] Let’s jump onto some basic...

Read More

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.

Pin It on Pinterest