-   Linux - Newbie (
-   -   Patching in linux..... (

westman 02-20-2006 09:47 PM

Patching in linux.....

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?


btmiller 02-20-2006 09:49 PM

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.

westman 02-20-2006 10:27 PM

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?

btmiller 02-20-2006 11:17 PM

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.

All times are GMT -5. The time now is 06:24 AM.