While …

libreoffice -p mytextfile.txt

… works fine and without opening a window (like head-less mode, which is what I want to do), Libreoffice is a very big application to solve such a small task.

Mousepad, gedit and kate don't allow printing from the command line, however.

Does another graphical text-editor allow to do it?


[Edit] Not a duplicate of the "how to print from command-line" question, since I don't want to print from command-line but start a graphical text-editor from command-line with a given text-file name, and then this graphical text-editor prints the given text-file with the editor's set font and page size settings.

Libreoffice does do that but it's a huge application, and I'm looking for a smaller graphical application doing the same.

  • 1
    Probably because it is too easy to print a text file from the command line, this is not implemented in the editor itself. See duplicate question. – vanadium Oct 31 '18 at 12:10
  • 3
    Possible duplicate of Print from command line – vanadium Oct 31 '18 at 12:10

The abiword man pages say you can print from the cli

abiword --to=ps --to-name=fd://1 FILENAME | lp

I'm not sure if it works headless though. I don't have a printer setup to test

A further look into the cammand shows abiword is converting the file to ps format saving it to a temporary file and piping it to the lp command.

lp: lp submits files for printing or alters a pending job. Use a filename of "-" to force printing from the standard input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.