Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to patch a file/package? What is the command used to patch? I have encountered a 'zcat' command, is this one of the way to apply patches? Can someone list down the command?
You use the patch command to patch source code files. Patches are generally delivered as a diff. If the patch is big, it is sometimes gzipped so it must be unzipped before use. A handy way to do this is:
zcat <patchfile> | patch
This decompresses the file and passes the decompressed result to the patch command. The patch command has a number of options. I suggest you read its man page (type "man patch" with no quotes at the command line) for more details.
Hi,
Thanks for the reply, btmiller. According to the manual, it didn't mention anything about zcat. So, does this mean that there are other ways to patch beside using zcat command? For example, just using
patch -p patch-name.gz
Is this correct?
You said that the patch maybe available in gzipped(gz) if it too big. So how do I apply patch for some source file using a patch file zipped in bz2 extension?
The zcat command has nothing to do with the patching process, it's just a convenient way to feed a gzipped file to the patch program (via a pipe |). If the patch had a bz2 extension you would have to use bzcat.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.