![Ubuntu 18.04 上的打印机副本](https://linux22.com/image/918513/Ubuntu%2018.04%20%E4%B8%8A%E7%9A%84%E6%89%93%E5%8D%B0%E6%9C%BA%E5%89%AF%E6%9C%AC.png)
我想在 Ubuntu 18.04 (Gnome) 中使用不同的设置创建我的打印机的副本。我相信这在 16.04 (nautilus) 上是可行的,但我现在找不到任何方法来实现。
有人有想法吗?
答案1
很简单!只需将浏览器导航到 CUPS 管理页面,http://localhost:631
然后添加具有新名称和特性但具有相同设备 URI 的打印机。我有一个 bash 脚本和几个别名,可以帮助我处理多个 CUPS 队列:
walt@bat:~(0)$ alias lpqa
alias lpqa='for i in $( lpstat -a | cut -f1 "-d " ) ; do lpq -P $i; done'
walt@bat:~(0)$ alias lpqac
alias lpqac='for i in $( lpstat -a | cut -f1 "-d " ) ; do lpq -P $i| egrep -v "no entries" | $HOME/bin/rcg "is not ready" BRIGHT_RED "is ready" BRIGHT_GREEN; done'
〜/ bin / cupsswitch:
#!/bin/bash
# Walt Sullivan, Walt Sullivan Software, Ltd.
# determine my name
me=$0
me=${me##*/}
declare -i debug=0
declare -i verbose=0
# -h or --help
help () {
cat <<EOF
${me} [-h|--help] [-v|--verbose] newqueue
${me}: Tell CUPS to disable the current print queue and enable newqueue.
EOF
exit 2
}
# from /usr/share/doc/util-linux/examples/getopt-parse.bash 2015-Sep-06
# # Note that we use `"$@"' to let each command-line parameter expand to a
# # separate word. The quotes around `$@' are essential!
# # We need TEMP as the `eval set --' would nuke the return value of getopt.
TEMP=`getopt -o dhv --long debug,help,verbose \
-n 'cupsswitch.bash' -- "$@"`
if [[ $? != 0 ]] ; then echo "${me} --help for help." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-d|--debug) debug=1; shift;;
-h|--help) help; shift;;
-v|--verbose) verbose=1; shift;;
--) shift; break;;
*) echo "Internal error! ${me} --help for help";exit 1;;
esac
done
if [[ $# -ne 1 ]] ; then
help
fi
newqueue="$1"
lpstat -p | egrep -q "^printer $newqueue "
if [[ ${PIPESTATUS[1]} != 0 ]] ; then
echo "Cannot switch to $newqueue - not a printer" >&2
exit 3
fi
for p in $(lpstat -p | grep enabled | awk '{print $2}') ; do
[[ $verbose -ne 0 ]] && printf "Disabling $p\n"
cupsdisable $p
done
[[ $verbose -ne 0 ]] && printf "Enabling $newqueue\n"
cupsenable $newqueue
[[ $verbose != 0 ]] && lpstat -p | egrep -B1 "ready to print"
[[ $verbose != 0 ]] && lpstat -p | egrep "is idle"
exit 0
请rcg: Regex Colored Glasses
参阅 O'Reilly Linux Server Hacks 一书,或https://stackoverflow.com/questions/981601/colorized-grep-viewing-the-entire-file-with-highlighted-matches/1056786#1056786