Blog background
The author has always wanted to understand how to use the Print
command under Linux?
Direct Print hello. TXT
will report an error
Error: no "print" mailcap rules found for type "text/plain"
Specific operation
ubuntu@139:~/temp $ cat /etc/mailcap | egrep print
application/x-troff-man; /usr/bin/nroff -mandoc -Tutf8; copiousoutput; print=/usr/bin/nroff -mandoc -Tutf8 | print text/plain:-
text/troff; /usr/bin/nroff -mandoc -Tutf8; copiousoutput; print=/usr/bin/nroff -mandoc -Tutf8 | print text/plain:-
text/plain; view %s; edit=vim %s; compose=vim %s; test=test -x /usr/bin/vim; print=cat %s; needsterminal
application/x-tar; /bin/tar tvf '%s'; print=/bin/tar tvf - | print text/plain:-; copiousoutput
application/x-gtar; /bin/tar tvf '%s'; print=/bin/tar tvf - | print text/plain:-; copiousoutput
application/x-ustar; /bin/tar tvf '%s'; print=/bin/tar tvf - | print text/plain:-; copiousoutput
ubuntu@139:~/temp $ ls
hello hi.txt
ubuntu@139:~/temp $ cat hi.txt
hello
ubuntu@139:~/temp $ print hi.txt
hello
This is the situation after I edit the mailcap file. Pay attention to this line
text/plain; view %s; edit=vim %s; compose=vim %s; test=test -x /usr/bin/vim; print=cat %s; needsterminal
That is, just add a print command rule after text/plain, which is so simple.