![]() zcat -f logfile.gz Reading compressed files with zless and zmore This will display the content of the file irrespective of whether it is gzipped or not. ![]() gz extension), you can use zcat with option -f. If you don’t know if the file is compressed or not (i.e. You can use regular less and more commands with zcat to see the output in pages: zcat logfile.gz | less zcat logfile.gz | more Actually, it does kind of extract it temporarily in /tmp but that’s not the same as an actual extraction, is it? This will display all the contents of logfile.gz without even extracting it. zcat is used in exactly the same manner as you use cat. If you use cat, you can replace it with zcat. ![]() It works directly on the compressed files. zdiff for diff to see the difference between two compressed filesīest thing about using these Z commands is that you don’t have to extract the compressed files.zless for less, zmore for more, to view the file in pages.zgrep for grep to search inside the compressed file.These Z commands provide a ‘Z’ equivalent of the regular file manipulation commands. This is not unusual because compressing the log files saves a lot of storage and thus saves the storage cost.īut unlike the regular text files where you can use cat to see all the content of the file or use grep command on it or use less to read the content without flooding your screen, compressed files cannot be used with the same regular Linux commands.ĭon’t worry, because when you have gzipped files, you also have the powerful Z commands to work on them. If you work on backend logs, you might have noticed that they are mostly compressed with. How to read Gzip compressed files in Linux command line In this article, we shall see how can you read and work on gzipped files. After all, It’s FOSS came into existence for the sole purpose of sharing Linux experience. Over the years, I have learned a few tips, tricks and best practices on Linux command line, on my own and from my colleagues alike.Īnd I have decided to share the same Linux command line tips with you on It’s FOSS. While working on the remote Linux boxes, I use command line extensively. If you work in an enterprise sector as software engineer, you might be familiar with this kind of set up. While at work, I (have to) use Windows 7 and connect to Linux machines via Putty. It’s because I use desktop Linux at home and mostly tinker with it. On It’s FOSS I mostly discuss about desktop Linux. f: stands for the file name of Tar Create tar.gz from multiple files tar -cvzf file1.txt file2.txt file3.Brief: This short tutorial shows you how to read those gzipped compressed log files on a Linux box.v: for Verbose shows processing during tar creation.You can create a tar archive from files or folders The basic option and syntax of the tar command are as shown the below: tar In this tutorial, we will show you how to create and extract tar.gz file in Linux using the terminal. A tar archive is pre-installed on many Linux Operating Systems, and it stands for “Tape Archive” every so often it is also referred to as the tarball. Most Linux distributions used tar by default. The tar is the most wildly used archive package in Linux OS, just like zip files. Every Linux user should be familiar with the the tar command, at least the basics. Most open-source packages are distributed in tar format. If you are new to Linux OS, you must be heard of the tar files. In addition we’ll showcase other basic tar options too. The topic for this post will be how to extract tar.gz file in Linux using the tar tool in terminal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |