export PATH=/usr/bin:/bin:/usr/sbin:/sbin
export IFS=$' \t\n'
open -a 'Printer Setup Utility'
man 8 system_profiler
/usr/sbin/system_profiler -listDataTypes
/usr/sbin/system_profiler SPPrintersDataType
defaultprinter=$(/usr/sbin/system_profiler SPPrintersDataType | egrep -B 5 'Default: Yes' | head -n 1 | sed -e 's/^[[:space:]]*//' -e 's/:$//')
printf "%s\n" "$defaultprinter"
lpstat -d | awk '{print $NF}'
alias opendefaultprinter='/usr/bin/open -a "$defaultprinter"'
opendefaultprinter
testfile="${HOME}/Desktop/testfile.txt"
/usr/bin/jot -b 'This is a test sentence!' 10 | cat -n > "$testfile"
open -e "$testfile"
/usr/bin/enscript -p ~/Desktop/testfile.ps "$testfile"
open ~/Desktop/testfile.ps
/usr/bin/enscript -p - "$testfile" | lpr
opendefaultprinter
ls -l <((/usr/bin/jot -b 'This is a test sentence!' 10))
stat -x <((/usr/bin/jot -b 'This is a test sentence!' 10))
cat -n <((/usr/bin/jot -b 'This is a test sentence!' 10))
/usr/bin/enscript -p ~/Desktop/testfile.ps <((/usr/bin/jot -b 'This is a test sentence!' 10))
open ~/Desktop/testfile.ps
enscript -p - <((/usr/bin/jot -b 'This is a test sentence!' 10)) | lpr
opendefaultprinter
man pstopdf
man enscript
enscript --help
enscript --list-media
enscript --list-options
/usr/bin/enscript -p ~/Desktop/testfile.ps "$testfile"
/usr/bin/pstopdf ~/Desktop/testfile.ps
open ~/Desktop/testfile.pdf
/usr/bin/enscript -p - "$testfile" | /usr/bin/pstopdf -i -o ~/Desktop/test.pdf
open ~/Desktop/test.pdf
echo 'Hello, world!' | enscript -q -B --word-wrap -f Helvetica30 -p - | lpr
lpstat -d
lpstat -W completed
lpstat -W not-completed
lpq -a
lpq -P $(/usr/bin/lpstat -d | /usr/bin/awk '{print $NF}')
opendefaultprinter
open http://127.0.0.1:631/printers
open "http://127.0.0.1:631/printers/$(/usr/bin/lpstat -d | /usr/bin/awk '{print $NF}')"
function cpq() {
/usr/bin/cancel -a -
return 0
}
lpq -P $(lpstat -d | awk '{print $NF}') | awk '{print $3}' | egrep "[[:digit:]]+"
lpstat -W not-completed | awk '{print $1}' | sed -n -E -e 's/^.*-([[:digit:]]+)$/\1/p'
function cpq() {
defaultprinter=$(/usr/bin/lpstat -d | /usr/bin/awk '{print $NF}')
for jobid in $(/usr/bin/lpstat -W not-completed | awk '{print $1}' | sed -E -n -e 's/^.*-([[:digit:]]+)$/\1/p'); do
/usr/bin/lprm -P "$defaultprinter" $jobid
done
return 0
}
cat -n /usr/share/enscript/font.map
enscript -q -B --word-wrap -f Times-Roman25 -p - <((jot -b 'This is a test sentence!' 10 )) | pstopdf -i -o ~/Desktop/test.pdf
open ~/Desktop/test.pdf
man groff
groff --help
info groff
info --show-options groff
open http://www.groff-wiki.info
open http://www.gnu.org/software/groff/manual/groff.pdf
open /usr/share/doc/groff/1.19.1/html/momdoc/intro.html
open /usr/share/doc/groff/1.19.2/pdf/pdfmark.pdf
echo 'Hello, world!' | groff -Tps - | lpr
groff -Tps <((jot -b $'This is a test sentence!\n' 10)) | lpr
groff -Tps <((jot -b $'This is a test sentence!' 10)) > ~/Desktop/test.ps
open ~/Desktop/test.ps
echo 'Hello, world!' | groff -Tps - | pstopdf -i -o ~/Desktop/test.pdf
open ~/Desktop/test.pdf
groff -Tps <((jot -b $'This is a test sentence!\n' 10 )) | pstopdf -i -o ~/Desktop/test.pdf
open ~/Desktop/test.pdf
# cf. http://www.macgeekery.com/tips/cli/pretty-print_manual_pages_as_ps_pdf_or_html
function pdfman() { man $1 -t | open -f -a Preview; return 0; };
function printman() { man $1 -t | lpr; return 0; };
pdfman bash
printman bash