有没有办法从 nano 文本编辑器打印文档,即将其发送到打印机进行物理打印?我看到 vim 和 emacs 有这个功能,但我喜欢 nano 的简单性。如果没有,有没有办法用 linux 命令打印文档?
答案1
nano
我在手册中没有看到任何打印命令的提及,如果能找到,我会很惊讶。 *nix 系统中传统的打印方法是以下lpr
命令:
$ lpr foo.txt
从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.
您还可以使用稍微更现代的等效方法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.
答案2
我需要做同样的事情。我的解决方案是使用命令行:
- 类型
less filename >> filename.txt.
- 然后我打字
lp filename.txt
并打印出来!