Robert Elder Software Inc.
  • Home
  • Store
  • Blog
  • Contact
  • Home
  • Store
  • Blog
  • Contact
  • #linux
  • |
  • #commandline
  • |
  • #softwareengineering
  • |
  • #embeddedsystems
  • |
  • #compilers
  • ...
  • View All >>

Intro To 'pr' Command In Linux

2024-01-03 - By Robert Elder

     I use the 'pr' command to format text files for printing.  For example, here I have a file called 'interject.txt':

cat interject.txt
I'd just like to interject for a moment.  What you're
referring to as Linux, is in fact, GNU/Linux, or as I've
recently taken to calling it, GNU plus Linux.  Linux is
not an operating system unto itself, but rather another
free component of a fully functioning GNU system made
useful by the GNU corelibs, shell utilities and vital
system components comprising a full OS as defined by POSIX.

     If I run the 'pr' command like this:

pr interject.txt

     the output will include some of the standard headers that you expect to see on printed documents:

024-01-11 19:00                  interject.txt                   Page 1


I'd just like to interject for a moment.  What you're
referring to as Linux, is in fact, GNU/Linux, or as I've
recently taken to calling it, GNU plus Linux.  Linux is
not an operating system unto itself, but rather another
free component of a fully functioning GNU system made
useful by the GNU corelibs, shell utilities and vital
system components comprising a full OS as defined by POSIX.



Document Formatting With The 'pr' Command

     The 'pr' command includes a number of other features for formatting documents.  To illustrate some of these features, imagine the following scenario where you've been given a pink slip stating that your employment has been terminated:

Pink Slip Termination Notice

     At this point, you might consider making a resume to find a new job so that you can pay your negatively amortized Canadian mortgage:

cat resume.txt
Introduction

It all started back in the year 2007 when I decided to write a fishing bot for the online video game "World of Warcraft".  Things were different back in those days.  I used to have all the time in the world to learn about programming, so that's exactly what I did.  I started out writing visual basic programs but they would alwas end up crashing because of memory leaks, but back in those days, I didn't even know what a memory leak was!  I used to listen to Dj Tiesto remixes while I was programming.  Ah, the good ole days.  Back when Tiesto made his best work.  Some people say his newer stuff is pretty good, but I think it kind of just all sounds the same.  But anyways, where was I?  Oh yes, the visual basic programs.  So I was working on writing a visual basic program to backtest various day trading strategies, but I guess that's confusing because I just said that I was working on a fishing bot for World of Warcraft, but hey, I can work on more than one thing a time right?  It turns out that writing a bot that can day trade the stock market is kind of hard, so then I decided to get a degree in software engineering.  5 years later I realized that even if you know how to program a trading bot, you're probably not going to be successful with the trading bot alone, so I abandoned the idea.  I guess if you also learned a lot about the finance industry too, and got some high-speed connections directly into the exchanges?  I watched some documentaries that talk about how much effort these automated trading exchanges put in so much time and effort just to get lower latency.  It's really expensive stuff, and I don't have the start up capital to even think about trying that.  Anyways, I hope I'm not rambling too much.  How are things going with you?  I hope I'm doing well on this resume, because I am extremely desperate and no one seems to want to hire for some reason.


Summary

I am seeking a position to successfully succeed in my goals to further my goal of self-actualizing and making the world a better place.

Experience

-  CEO of Robert Elder Software Inc. (2014 to 2023)

Education

-  Beej's Guide to Network Programming

Skills

AngularJS,
Backbone.js,
Ember.js,
Express.js,
Meteor,
Mojito,
Next.js,
Prototype,
React.js,
Vue.js,
jQuery,
jQuery UI,
Underscore.js,
d3.js,
Postgresql,
Mysql,
mongodb,
Docker,
Python,
Java,
Javascript,
ISO C89
ISO C99
C++ 2011

Strengths

Unix
Linux
AWS

Weaknesses

Windows
Azure Cloud

     I can use the 'pr' command to format the above resume in the style of an original Unix version 1 document from 1971:

cat resume.txt | fold -w 20 | pr -h "HIRE THIS MAN" --columns 2 -n -s"    "  -w 60
2024-01-12 15:33            HIRE THIS MAN             Page 1


    1	Introduction		   57	 I decided to get a
    2				   58	degree in software e
    3	It all started back	   59	ngineering.  5 years
    4	in the year 2007 whe	   60	 later I realized th
    5	n I decided to write	   61	at even if you know
    6	 a fishing bot for t	   62	how to program a tra
    7	he online video game	   63	ding bot, you're pro
    8	 "World of Warcraft"	   64	bably not going to b
    9	.  Things were diffe	   65	e successful with th
   10	rent back in those d	   66	e trading bot alone,
   11	ays.  I used to have	   67	 so I abandoned the
   12	 all the time in the	   68	idea.  I guess if yo
   13	 world to learn abou	   69	u also learned a lot
   14	t programming, so th	   70	 about the finance i
   15	at's exactly what I	   71	ndustry too, and got
   16	did.  I started out	   72	 some high-speed con
   17	writing visual basic	   73	nections directly in
   18	 programs but they w	   74	to the exchanges?  I
   19	ould alwas end up cr	   75	 watched some docume
   20	ashing because of me	   76	ntaries that talk ab
   21	mory leaks, but back	   77	out how much effort
   22	 in those days, I di	   78	these automated trad
   23	dn't even know what	   79	ing exchanges put in
   24	a memory leak was!	   80	 so much time and ef
   25	I used to listen to	   81	fort just to get low
   26	Dj Tiesto remixes wh	   82	er latency.  It's re
   27	ile I was programmin	   83	ally expensive stuff
   28	g.  Ah, the good ole	   84	, and I don't have t
   29	 days.	Back when Ti	   85	he start up capital
   30	esto made his best w	   86	to even think about
   31	ork.  Some people sa	   87	trying that.  Anyway
   32	y his newer stuff is	   88	s, I hope I'm not ra
   33	 pretty good, but I	   89	mbling too much.  Ho
   34	think it kind of jus	   90	w are things going w
   35	t all sounds the sam	   91	ith you?  I hope I'm
   36	e.  But anyways, whe	   92	 doing well on this
   37	re was I?  Oh yes, t	   93	resume, because I am
   38	he visual basic prog	   94	 extremely desperate
   39	rams.  So I was work	   95	 and no one seems to
   40	ing on writing a vis	   96	 want to hire for so
   41	ual basic program to	   97	me reason.
   42	 backtest various da	   98
   43	y trading strategies	   99
   44	, but I guess that's	  100	Summary
   45	 confusing because I	  101
   46	 just said that I wa	  102	I am seeking a posit
   47	s working on a fishi	  103	ion to successfully
   48	ng bot for World of	  104	succeed in my goals
   49	Warcraft, but hey, I	  105	to further my goal o
   50	 can work on more th	  106	f self-actualizing a
   51	an one thing a time	  107	nd making the world
   52	right?	It turns out	  108	a better place.
   53	 that writing a bot	  109
   54	that can day trade t	  110	Experience
   55	he stock market is k	  111
   56	ind of hard, so then	  112	-  CEO of Robert Eld







2024-01-12 15:33            HIRE THIS MAN             Page 2


  113	er Software Inc. (20	  136	d3.js,
  114	14 to 2023)		  137	Postgresql,
  115				  138	Mysql,
  116	Education		  139	mongodb,
  117				  140	Docker,
  118	-  Beej's Guide to N	  141	Python,
  119	etwork Programming	  142	Java,
  120				  143	Javascript,
  121	Skills			  144	ISO C89
  122				  145	ISO C99
  123	AngularJS,		  146	C++ 2011
  124	Backbone.js,		  147
  125	Ember.js,		  148	Strengths
  126	Express.js,		  149
  127	Meteor,			  150	Unix
  128	Mojito,			  151	Linux
  129	Next.js,		  152	AWS
  130	Prototype,		  153
  131	React.js,		  154	Weaknesses
  132	Vue.js,			  155
  133	jQuery,			  156	Windows
  134	jQuery UI,		  157	Azure Cloud
  135	Underscore.js,		  158

     Here is the same 'pr' command from above explained in detail:

pr -h "HIRE THIS MAN" --columns 2 -n -s"    "  -w 60

     The '-h "HIRE THIS MAN"' flag to set the page header. The '--columns 2' flag formats the pages for two columns, and the '-n' turns on line numbering. The '-s" "' flag sets the separator between columns to be four spaces, and the '-w' flag sets the page width to 60 characters.

     The resulting resume can be piped directly into my "HL-L2360D-series" printer using the 'lpr' command like this:

cat resume.txt | fold -w 20 | pr -h "HIRE THIS MAN" --columns 2 -n -s"    "  -w 60 | lpr -P HL-L2360D-series
Resulting Resume

     A resume this good is sure to generate hundreds of job offers, and allow you to afford luxuries like table salt, and not having to live with 5 roommates:

Not Having 5 Roommates

     And that's why the 'pr' command is my favourite Linux command.

Intro To 'stty' Command In Linux
Intro To 'stty' Command In Linux
Published 2023-10-04
Terminal Block Mining Simulation Game
$1.00 CAD
Terminal Block Mining Simulation Game
Intro To 'nproc' Command In Linux
Intro To 'nproc' Command In Linux
Published 2023-07-15
Intro To 'comm' Command In Linux
Intro To 'comm' Command In Linux
Published 2023-09-06
How To Force The 'true' Command To Return 'false'
How To Force The 'true' Command To Return 'false'
Published 2023-07-09
A Surprisingly Common Mistake Involving Wildcards & The Find Command
A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01
Intro To 'chroot' Command In Linux
Intro To 'chroot' Command In Linux
Published 2023-06-23
Join My Mailing List
Privacy Policy
Why Bother Subscribing?
  • Free Software/Engineering Content. I publish all of my educational content publicly for free so everybody can make use of it.  Why bother signing up for a paid 'course', when you can just sign up for this email list?
  • Read about cool new products that I'm building. How do I make money? Glad you asked!  You'll get some emails with examples of things that I sell.  You might even get some business ideas of your own :)
  • People actually like this email list. I know that sounds crazy, because who actually subscribes to email lists these days, right?  Well, some do, and if you end up not liking it, I give you permission to unsubscribe and mark it as spam.
© 2025 Robert Elder Software Inc.
SocialSocialSocialSocialSocialSocialSocial
Privacy Policy      Store Policies      Terms of Use