A common task on most modern operating systems is to combine and compress multiple files into a single file. This could be in order to store files on a smaller device, to make it easy to download files from a website, or to merge and compress files for email transport. This guide focuses on some of the more common Linux utilities that merge and compress files. Tar The purpose of the tar command, which stands for tape archive, is to merge multiple files into a single file. To create a tar file named sample.tar, execute the following #tar -cf sample.tar <files_to_merge> To list the contents of a .tar file: #tar -tf sample.tar To extract the contents of a .tar file: #tar -xf sample.tar d gzip Use the gzip command to compress files: #gzip <filename> To display percentage of compression, #gzip -v <filename> To decompress the file, #gzip -d <filename> Note that the gzip command replaces the original file with the smaller compressed file. gunzip Use the gunzip command to decompress gzipped files #gunzip <filename> bzip2 Use the bzip2 command to compress files: #bzip2 <filename> To Display percentage of compression. #bzip2 -v <filename> To Decompress the file #bzip2 -d <filename> Note that the bzip2 command replaces the original file with the compressed file. Xz Use the xz command to compress files: #xz <filename> You can use the unxz command to decompress...Read More
Author: Ruwantha Nissanka
Every file on the Linux filesystem starts with a single hard link. The link is between the filename and the actual data stored on the filesystem. Even if you delete the original file, the hard link will still has the data of the original file because the hard link acts as a mirror copy of the original file. In this guide, we will see how to create and manage hard links creating hard links When we create a hard link to a file with ln, an extra entry is added in the directory. A new file name is mapped to an existing inode. Both files have the same inode, so they will always have the same permissions and the same owner. Both files will have the same content. Actually, both files are equal now, meaning you can safely remove the original file, the hardlinked file will remain. The inode contains a counter, counting the number of hard links to itself. When the counter drops to zero, then the inode is emptied. finding hard links You can use the find command to look for files with a certain inode. The screenshot below shows how to search for all filenames that point to inode 674162. Remember that an inode number is unique to its partition. symbolic links Symbolic links (sometimes called soft links) do not link to inodes, but create a name to name...Read More
An inode is a data structure that contains metadata about a file. When the file system stores a new file on the hard disk, it stores not only the contents (data) of the file, but also extra properties like the name of the file, the creation date, its permissions, the owner of the file, and more. All this information (except the name of the file and the contents of the file) is stored in the inode of the file. The ls -l command will display some of the inode contents, as seen in this screenshot #ls -ld <directory_name> The inode table contains all of the inodes and is created when you create the file system (with mkfs). You can use the df -i command to see how many inodes are used and free on mounted file systems. #df -i In the df -i screenshot above you can see the inode usage for several mounted file systems. You don’t see numbers for /dev/sda2 because it is a fat file system. inode number Inode number is also known as index number. It is a unique number assigned to files and directories while it is created. The inode number will be unique to entire filesystem. You can see the inode numbers with the ls -li command. #ls -li These three files were created one after the other and got three different inodes...Read More
Take this course
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.