Show Two Text Files Side By Side

Today’s article will be fairly simple, and easy enough for anyone to follow, as we talk about how to show two text files side by side. This is an immensely useful tool for editing text files. It’s a simple enough process and you probably won’t even have to install anything.

We all know what a text file is. I want to assume we can all see the value in comparing two text files side by side. If you want to compare and contrast text files, comparing them side by side is a pretty good way to do so visually. (Some tools will let you check the differences between files and I’ll likely do an article on some of those tools.)

We really don’t need anything special for this, but you can download the following file to your ~/Documents directory and we’ll all be on the same page – hopefully.

First, download this file:


Next, download this file:


Don’t worry. Those are identical files with the original created for another exercise. We’ll use them both this time around, just as the example, so download them both to your ~/Documents directory.

The tool we’ll be using is the pr command.

The pr Command:

This pr application is part of the core utilities, so pr should be installed by default. You can ensure that pr is installed by running the following command:

The output of that will also let you know that it’s a part of the core utilities, specifically with this text (the version number may vary):

pr (GNU coreutils) 8.32

Like always, you should probably check the man page to learn more about the application we’ll be using. To do so, it’s simply:

If you check the man page, you’ll see that pr is described as this:

pr – convert text files for printing

You’ll also see that there are a whole lot of options. For a new user, this will seem confusing and complex. Don’t worry, we’ll only be worried about a couple of the options (flags in the command) and it’ll be quite simple.

Now, the following is going to assume you’ve downloaded the sort files from above. I’ll include generic commands as well. I just want to keep this article relatively short.

Show Two Text Files Side By Side:

You will of course need an open terminal for this. That’s easily done and on most distros you can just press CTRL + ALT + T and your default terminal will open. If that’s not the case, you can find and open the terminal from your application menu.

With your terminal open, and assuming you downloaded the files to your ~/Documents directory, you’ll want to first change to that directory. So, that command would be this:

You should probably run the ls command to ensure that you see both sort.txt and sort1.txt. Assuming you see both files, the command you’re going to want to use would be something like this:

So, in our case, the command you want to run would be this:

A quick examination will show that the two files are indeed open and that they’re identical in every way. You’ve now been able to show two text files side by side – and you didn’t even need to install any applications to do so.

Of course, the pr command has a lot more to it. You can do a great deal with this command besides using it to show two text files side by side. If you want to manipulate text, it’s one of many tools. This particular tool is usually used for preparing text for print, but it can be used in this way easily enough.


I figured I’d keep this article nice and short. There’s no need to make it more wordy than required to get the point across. After all, it should be a simple task for people who do want to show two text files side by side. If it’s not simple, many folks won’t bother doing it. That’s one of the reasons why I try to keep some articles (including this one) simple enough to follow along. It’s great to expose people, especially new people, to new tools.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.