I can see no mention of a print command in nano
's manual and it would surprise me to find one. The traditional method of printing in *nix systems is the lpr
command:
$ lpr foo.txt
From man lpr
:
DESCRIPTION
lpr submits files for printing. Files named on the command line are
sent to the named printer (or the default destination if no destination
is specified). If no files are listed on the command-line, lpr reads
the print file from the standard input.
You can also use a slightly more modern equivalent, enscript
:
DESCRIPTION
Enscript converts text files to PostScript or to other output lan‐
guages. Enscript can spool the generated output directly to a speci‐
fied printer or leave it to a file. If no input files are given,
enscript processes the standard input stdin. Enscript can be extended
to handle different output media and it has many options which can be
used to customize the printouts.
Would this work for files with non .txt extensions? lpr will only print plaintext files but I need to print out source code for files with extensions like .cpp, but the contents are basically plaintext, aren't they? Thanks. – Neal – 2013-09-29T14:39:20.217
@Neal the *nix world does not use extensions not determine file type (some graphical apps do but those are another matter).
lpr
will treat its input as text and print it accordingly. – terdon – 2013-09-29T14:52:39.553