When it comes to Linux servers, system admins rarely use any graphical user interface. A simple command-line interface also known as CLI is enough for them to get what they are intended to do.
CLI has several advantages, but it also comes with its disadvantages. Beginners with limited knowledge get into trouble and are often seen breaking their servers.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux system files.
In this context, we shall look into how to control file content in Debian 10 Server.
How to use diff & patch command ?
The diff program has the ability to show the difference between two files. I will demonstrate to you how does it do exactly. Once you have experienced the power of diff, you will realize that how powerful your server administration experience will become.
If we have two files file1 and file2 with contents in them and then run the below command:
$ diff -u file1 file2
You will see that the diff -u command displayed the contents of both files. It also showed when they were updated and at what time.
If you modify file1 for now, and run the command again, you will see a clear picture of file1 on our server.
More about Patch Utility ?
Here, we will deal with patch utility. It helps us to take a patch file, the file which was created by diff and applies the difference to a file. Let's do it now:
$ diff -u file1 file2 > File
$ cat File
You will see that with the help of patch utility, I patched file1 and file2 into File which is now a patch file.
[Need help in fixing Linux System issues? We can assist you. ]