日常运维管理 常用命令(3)

查看定时任务

[root@tyzz ~]# crontab -l
#secu-tcs-agent monitor, install at Tue Feb 14 11:57:11 CST 2017
* * * * * /usr/local/sa/agent/secu-tcs-agent-mon-safe.sh /usr/local/sa/agent > /dev/null 2>&1
*/1 * * * * /usr/local/qcloud/stargate/admin/start.sh > /dev/null 2>&1 &
*/20 * * * * /usr/sbin/ntpdate ntpupdate.tencentyun.com >/dev/null &
[root@tyzz ~]# crontab -u test1 -l
no crontab for test1

编辑

[root@tyzz ~]# crontab -e
分 时 日 月 周  所要执行的操作

图形化管理系统服务

ntsysv

chkconfig

[root@tyzz cron]# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

iprdump            0:off    1:off    2:on    3:on    4:on    5:on    6:off
iprinit            0:off    1:off    2:on    3:on    4:on    5:on    6:off
iprupdate          0:off    1:off    2:on    3:on    4:on    5:on    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
network            0:off    1:off    2:on    3:on    4:on    5:on    6:off
[root@tyzz cron]#
6系:[root@tyzz cron]# chkconfig httpd on

7系:[root@tyzz cron]# systemctl enable httpd
[root@tyzz log]# pwd
/var/log
[root@tyzz log]# ls
anaconda  boot.log  btmp-20170301  cron   dmesg.old  lastlog  mariadb   ppp     spooler   tuned  yum.log
audit     btmp      chrony         dmesg  httpd      maillog  ntpstats  puppet  tallylog  wtmp
[root@tyzz log]#

dmesg 查看硬件相关的故障日志 (磁盘 网卡)

exex用法
[root@tyzz log]# find /var/log/ -type f -mtime +10 -exec cp {} {}.bak ;

screen 命令

[root@tyzz ~]# screen     #进入

ctrl a+d  推出(打入后台)
exit 完全退出

[root@tyzz ~]# screen -ls   #开启了的 screen
There are screens on:
    20549.pts-1.tyzz    (Detached)
    20476.pts-1.tyzz    (Detached)
2 Sockets in /var/run/screen/S-root.

[root@tyzz ~]# screen -r 20549   #进入相关的screen

curl

[root@tyzz ~]# curl -x 220.181.111.188:80 -I www.baidu.com
HTTP/1.1 200 OK
Date: Wed, 01 Mar 2017 09:32:49 GMT
Server: Apache
P3P: CP=" OTI DSP COR IVA OUR IND COM "
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Set-Cookie: BAIDUID=A35A0983905AF6C7FF97A5F979D31A17:FG=1; expires=Thu, 01-Mar-18 09:32:49 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Set-Cookie: BAIDUID=A35A0983905AF6C741F47F4511D32D76:FG=1; expires=Thu, 01-Mar-18 09:32:49 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Last-Modified: Wed, 08 Feb 2017 07:55:35 GMT
ETag: "1cd6-5480030886bc0"
Accept-Ranges: bytes
Content-Length: 7382
Cache-Control: max-age=1
Expires: Wed, 01 Mar 2017 09:32:50 GMT
Vary: Accept-Encoding,User-Agent
Connection: Keep-Alive
Content-Type: text/html

[root@tyzz ~]# curl -Iv www.baidu.com
* About to connect() to www.baidu.com port 80 (#0)
*   Trying 220.181.112.244...
* Connected to www.baidu.com (220.181.112.244) port 80 (#0)
> HEAD / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.baidu.com
> Accept: */*
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: bfe/1.0.8.18
Server: bfe/1.0.8.18
< Date: Wed, 01 Mar 2017 09:36:36 GMT
Date: Wed, 01 Mar 2017 09:36:36 GMT
< Content-Type: text/html
Content-Type: text/html
< Content-Length: 277
Content-Length: 277
< Last-Modified: Mon, 13 Jun 2016 02:50:06 GMT
Last-Modified: Mon, 13 Jun 2016 02:50:06 GMT
< Connection: Keep-Alive
Connection: Keep-Alive
< ETag: "575e1f5e-115"
ETag: "575e1f5e-115"
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Pragma: no-cache
Pragma: no-cache
< Accept-Ranges: bytes
Accept-Ranges: bytes

< 
* Connection #0 to host www.baidu.com left intact
[root@tyzz ~]# curl -O https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3706  100  3706    0     0  14378      0 --:--:-- --:--:-- --:--:-- 14364

-I 不显示html内容

-x 指定ip和端口

-v 显示过程

-O 下载

原文地址:https://www.cnblogs.com/aallenn/p/6700579.html