I would like to use a Linux distro without a desktop environment, but I need to print out homework that I type up.I could always email it to myself and print from another computer, but it would be nice if I could just do something like print homework.txt from a bash prompt. Does anyone have a way of doing this?
Print text from terminal
command line;printing
CUPS understands many different types of files directly, including text, PostScript, PDF, and image files. This allows you to print from inside your applications or at the command-line, whichever is most convenient! Type either of the following commands to print a file to the default (or only) printer on the system:lp filename lpr filenameUse the -d option with the lp command to print to a specific printer:lp -d printer filenameOr the -P option with the lpr command:lpr -P printer filenamePrinting the Output of a ProgramBoth the lp and lpr commands support printing from the standard input:program | lp program | lp -d printer program | lpr program | lpr -P printerIf the program does not provide any output, then nothing will be queued for printing.Source and more Details.