linux 命令cancel 介绍和使用案例
Linux 中的 cancel 命令用于取消打印作业
命令介绍cancel 命令的基本语法如下:
textcancel [options] [destination] [id]options:可选项,用于指定取消作业的方式。destination:打印机名称或类名。id:要取消的作业 ID。常用选项包括:
-a:取消指定打印机上的所有作业。-E:连接服务器时强制使用加密。-h hostname[:port]:指定备用服务器。-u username:取消指定用户的作业命令安装部署:
root@meng:~# cancel
Command 'cancel' not found, but can be installed with:
apt install cups-client # version 2.4.1op1-1ubuntu4.10, or
apt install lprng # version 3.8.B-5
root@meng:~# apt install lprng
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
magicfilter lprng-doc
The following NEW packages will be installed:
lprng
0 upgraded, 1 newly installed, 0 to remove and 216 not upgraded.
Need to get 540 kB of archives.
After this operation, 3154 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 lprng amd64 3.8.B-5 [540 kB]
Fetched 540 kB in 1s (634 kB/s)
Preconfiguring packages ...
Selecting previously unselected package lprng.
(Reading database ... 75093 files and directories currently installed.)
Preparing to unpack .../lprng_3.8.B-5_amd64.deb ...
Unpacking lprng (3.8.B-5) ...
Setting up lprng (3.8.B-5) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
在没有安装打印机驱动会提示报错:
root@meng:~# cancel
Read_file_list: cannot stat required or included file '/etc/printcap' - No such file or directory
root@meng:~# cancel -a
Read_file_list: cannot stat required or included file '/etc/printcap' - No such file or directory
root@meng:~# systemctl restart cups
Failed to restart cups.service: Unit cups.service not found.
root@meng:~# systemctl restart cups
Failed to restart cups.service: Unit cups.service not found.
root@meng:~# tail -n 50 /var/log/cups/error_log
tail: cannot open '/var/log/cups/error_log' for reading: No such file or directory
root@meng:~#