timeout是一个命令行实用程序,它运行指定的命令,如果在给定的时间段后仍在运行,则终止该命令。timeout命令是GNU核心实用程序软件包的一部分,该软件包几乎安装在所有Linux发行版中。

NAMEtimeout - run a command with a time limitSYNOPSIStimeout [OPTION] DURATION COMMAND [ARG]...timeout [OPTION]
$ timeout 5 ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=128 time=0.410 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=128 time=0.181 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=128 time=0.174 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=128 time=0.146 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=128 time=0.174 ms$ timeout -s SIGKILL 5s ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=128 time=0.331 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=128 time=0.207 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=128 time=0.385 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=128 time=0.393 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=128 time=0.123 ms
Killed$ timeout -s 9 5s ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=128 time=0.281 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=128 time=0.355 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=128 time=0.507 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=128 time=0.215 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=128 time=0.167 ms
Killed$ kill -l1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP6) SIGABRT      7) SIGEMT       8) SIGFPE       9) SIGKILL     10) SIGBUS
11) SIGSEGV     12) SIGSYS      13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGURG      17) SIGSTOP     18) SIGTSTP     19) SIGCONT     20) SIGCHLD
21) SIGTTIN     22) SIGTTOU     23) SIGIO       24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGPWR      30) SIGUSR1
31) SIGUSR2     32) SIGRTMIN    33) SIGRTMIN+1  34) SIGRTMIN+2  35) SIGRTMIN+3
36) SIGRTMIN+4  37) SIGRTMIN+5  38) SIGRTMIN+6  39) SIGRTMIN+7  40) SIGRTMIN+8
41) SIGRTMIN+9  42) SIGRTMIN+10 43) SIGRTMIN+11 44) SIGRTMIN+12 45) SIGRTMIN+13
46) SIGRTMIN+14 47) SIGRTMIN+15 48) SIGRTMIN+16 49) SIGRTMAX-15 50) SIGRTMAX-14
51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9
56) SIGRTMAX-8  57) SIGRTMAX-7  58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4
61) SIGRTMAX-3  62) SIGRTMAX-2  63) SIGRTMAX-1  64) SIGRTMAX$ timeout -k 2s 1m ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=128 time=0.296 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=128 time=0.160 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=128 time=0.121 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=128 time=0.146 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=128 time=0.160 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=128 time=0.525 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=128 time=0.142 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=128 time=0.178 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=128 time=0.516 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=128 time=0.148 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=128 time=0.134 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=128 time=0.145 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=128 time=0.169 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=128 time=0.165 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=128 time=0.181 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=128 time=0.172 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=128 time=0.141 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=128 time=0.166 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=128 time=0.185 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=128 time=0.163 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=128 time=0.153 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=128 time=0.157 ms
64 bytes from 127.0.0.1: icmp_seq=22 ttl=128 time=0.165 ms
64 bytes from 127.0.0.1: icmp_seq=23 ttl=128 time=0.148 ms
64 bytes from 127.0.0.1: icmp_seq=24 ttl=128 time=0.119 ms
64 bytes from 127.0.0.1: icmp_seq=25 ttl=128 time=0.172 ms
64 bytes from 127.0.0.1: icmp_seq=26 ttl=128 time=0.177 ms
64 bytes from 127.0.0.1: icmp_seq=27 ttl=128 time=0.189 ms
64 bytes from 127.0.0.1: icmp_seq=28 ttl=128 time=0.143 ms
64 bytes from 127.0.0.1: icmp_seq=29 ttl=128 time=0.163 ms
64 bytes from 127.0.0.1: icmp_seq=30 ttl=128 time=0.155 ms
64 bytes from 127.0.0.1: icmp_seq=31 ttl=128 time=0.156 ms
64 bytes from 127.0.0.1: icmp_seq=32 ttl=128 time=0.275 ms
64 bytes from 127.0.0.1: icmp_seq=33 ttl=128 time=0.361 ms
64 bytes from 127.0.0.1: icmp_seq=34 ttl=128 time=0.379 ms
64 bytes from 127.0.0.1: icmp_seq=35 ttl=128 time=0.116 ms
64 bytes from 127.0.0.1: icmp_seq=36 ttl=128 time=0.210 ms
64 bytes from 127.0.0.1: icmp_seq=37 ttl=128 time=0.157 ms
64 bytes from 127.0.0.1: icmp_seq=38 ttl=128 time=0.148 ms
64 bytes from 127.0.0.1: icmp_seq=39 ttl=128 time=0.192 ms
64 bytes from 127.0.0.1: icmp_seq=40 ttl=128 time=0.143 ms
64 bytes from 127.0.0.1: icmp_seq=41 ttl=128 time=0.183 ms
64 bytes from 127.0.0.1: icmp_seq=42 ttl=128 time=0.185 ms
64 bytes from 127.0.0.1: icmp_seq=43 ttl=128 time=0.181 ms
64 bytes from 127.0.0.1: icmp_seq=44 ttl=128 time=0.162 ms
64 bytes from 127.0.0.1: icmp_seq=45 ttl=128 time=0.187 ms
64 bytes from 127.0.0.1: icmp_seq=46 ttl=128 time=0.165 ms
64 bytes from 127.0.0.1: icmp_seq=47 ttl=128 time=0.146 ms
64 bytes from 127.0.0.1: icmp_seq=48 ttl=128 time=0.138 ms
64 bytes from 127.0.0.1: icmp_seq=49 ttl=128 time=0.175 ms
64 bytes from 127.0.0.1: icmp_seq=50 ttl=128 time=0.154 ms
64 bytes from 127.0.0.1: icmp_seq=51 ttl=128 time=0.162 ms
64 bytes from 127.0.0.1: icmp_seq=52 ttl=128 time=0.169 ms
64 bytes from 127.0.0.1: icmp_seq=53 ttl=128 time=0.146 ms
64 bytes from 127.0.0.1: icmp_seq=54 ttl=128 time=0.170 ms
64 bytes from 127.0.0.1: icmp_seq=55 ttl=128 time=0.189 ms
64 bytes from 127.0.0.1: icmp_seq=56 ttl=128 time=0.183 ms
64 bytes from 127.0.0.1: icmp_seq=57 ttl=128 time=0.165 ms
64 bytes from 127.0.0.1: icmp_seq=58 ttl=128 time=0.176 ms
64 bytes from 127.0.0.1: icmp_seq=59 ttl=128 time=0.194 ms

Linux timeout命令的使用:timeout - run a command with a time limit相关推荐

  1. linux jar命令找不到 -bash: jar: command not found

    通过jar命令进行打包或解压包的时候报:-bash: jar: command not found .JDK环境已经安装.[luopu@TESTWEB1_13 ~]$ echo $JAVA_HOME/ ...

  2. linux ping 命令_Linux ping命令示例

    linux ping 命令 The ping (Packet INternet Groper) command is one of the most widely used utility acros ...

  3. linux关机命令60秒,Linux关机重启命令有哪些用法

    今天小编给大家介绍下Linux系统的关机与重启命令,涉及的命令有shutdown.halt.reboot,也是本文主要讲解的命令,希望对正在学习的朋友有所帮助. 一,shutdown命令 在linux ...

  4. Linux timeout 命令

    Linux 里有个命令叫 timeout,它可以控制一个进程的最大执行时间,超时就会被 这个命令主动终结. 源码:https://github.com/coreutils/coreutils/blob ...

  5. Shell - timeout命令

    timeout是一个命令行工具,它运行一个指定的命令,如果在给定的时间后仍在运行,则终止该命令.换句话说,timeout命令允许你运行一个有时间限制的命令.timeout命令是GNU核心实用程序包的一 ...

  6. linux: 命令行运行php Run PHP from the command line

    As an alternative to /opt/lampp/bin/php, to run a php script from the command line, you just need to ...

  7. linux基础命令之一

    1.cpio cpio(copy in/out) 功能说明:备份文件. 语 法:cpio [-0aABckLovV][-C <输入/输出大小>][-F <备份档>][-H &l ...

  8. linux 应用命令

    一.文件处理命令 1.命令格式与目录处理命令 ls –a[查看隐藏文件]     ls –l[查看文件信息长格式显示]     ls –d[查看指定目录的详细信息]     ls –h[显示容量大小] ...

  9. Linux dhclient命令使用

    Linux dhclient命令使用 演示样例 获取ip 释放ip NAME SYNOPSIS DESCRIPTION OPERATION COMMAND LINE OPTIONS PORTS CON ...

最新文章

  1. Vue_VueRouter
  2. Win7 下面 用easybcd 引导 安装 ubuntu 14.04
  3. 我的代码和注释都写的像坨屎,那又怎么样?
  4. 给定一组查找关键字(19,14,23,1,65,20,84,27,55,11,10,79) 哈希函数为:H(key)=key % 13, 哈希表长为m=15,设每个记录的查找概率相等。【MOOC】
  5. 《Go语言圣经》学习笔记 第六章 方法
  6. python写配置文件方法_Python读写配置文件的方法
  7. 第九十六期:JavaScript 中的 4 个相等比较算法的介绍
  8. java进销存系统源码_青云源码——最新企业进销存管理系统源码分享
  9. 修改ranger ui的admin用户登录密码踩坑小记
  10. acs880变频器静态辨识_(完整版)ABB-ACS880变频器调试参数
  11. (CentOS7)IP地址的配置与主机名和hosts映射
  12. 安卓手机的这几个隐藏功能分享给你
  13. java让一个方法等待_如何写一个“等待”的方法?
  14. layer弹出层的位置设置
  15. 银河麒麟V10-桌面版 用户登录密码遗忘解决过程
  16. RocketMQ PERM含义 PERM=7、6、4、2
  17. python+xlrd做数字组合
  18. 基于目标检测的海上舰船图像超分辨率研究
  19. 软总线源码分析8:传输模块
  20. 计算机达人成长之路目录

热门文章

  1. pytorch clamp 与clamp_区别
  2. JAVA接口详细讲解
  3. (五)nginx设置静态文件不记录日志
  4. 不支持模块化规范的插件可以使用import 导入的原因
  5. 【BZOJ3781】小B的询问 莫队
  6. 谈卢梭的《爱弥尔》及其对于教育的现实意义
  7. 给你一碗孟婆汤,你会忘记什么?
  8. ServletContext读取属性文件
  9. mysql 触发器 new.id,mysql触发器的使用方法
  10. node升级命令_Vue CLI 4 发布:自动化升级过程,支持自定义包管理器