Text editors are the most common applications on Linux, and many people seem to have very strong opinions about this technology. Reading text files without editing them is something developers do on a daily basis. Some people prefer to use the less or more commands for this, but more and more people prefer a graphical environment for all text operations.
The xmore command can easily take the place of either of these commands. Perhaps more realistically, you can use it in any Bash, zsh or tcsh shell script you write. If you wanted to display a README or TODO file while a user executes an install script, then this is exceptionally easy to do with xmore. Novice users of Linux can easily proceed through an installation in this manner.
Method 1: Displaying Text with xmore
For an example, let’s assume you’re working with compiling your own apps from source, which is one of the most common daily tasks if you do any kind of development at all. If you downloaded a TODO list from a repository where you were working on Linux code, then you might want to try:
xmore ~/Downloads/TODO
We were using the TODO list from the versatile nano text editor as an example. It loads readily in a window, and parses all the text for easy reading.
Method 2: Using xmore in an Install Script
More realistically, you’ll find xmore used to pass late-breaking news to users installing apps or online gaming titles. You can use this anywhere you need to display a text file to a user in an install script. Let’s assume you needed to display a NEWS file that featured information about changes to a piece of software. You could add xmore NEWS -bg “cadet blue” to pop up a message box that the user can scroll through, but the install script won’t proceed until they’re done with it.
The -bg and -fg options can take any valid X11 color names you wish; cadet blue was merely used as an example. The lit of these is generally included in a file called rgb.txt in your X11 directory, which is a great resource for developers needing to use any of the basic XFree86 apps in their install scripts. These colors will generally remain the same across all Linux distributions that require the use of XFree86 as an X-Server. Should other X Servers be used in the future, these scripts will be in need of updates.
The post How to Use xmore to Display Text Files appeared first on Appuals.com.