×


Control File Content in Debian 10 Buster Linux Server

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. ]


Conclusion

This article covers how to efficiently use both diff and patch programs which help a Linux server admin to control their files and make new files when things go wrong. In fact, The grep command, which stands for global regular expression print, is one of the most versatile commands in a Linux terminal environment. It is an immensely powerful program that allows the user to sort input according to complex rules, which makes it a rather popular link in numerous command chains. The grep command is primarily used to search text or any file for lines that contain a match to the specified words/strings. By default, grep displays the matched lines, and it can be used to search for lines of text that match a regular expression(s), and it outputs only the matched lines.