zoukankan      html  css  js  c++  java
  • 系统管理

    系统管理

    进程管理
    • 显示当前进程数
        top -b -n >>s.log
    
    • 重启进程
    kill -1 PID
    
    • 强制停止进程
    kill -9 PID
    
    • 强制停止某一类进程
    killall -9 [pid_name]
    
    • 清除远程登陆的用户
    [root@centos6 mooc]# w
     23:58:42 up 15:06,  6 users,  load average: 0.00, 0.01, 0.05
    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
    root     :0       :0               08:53   ?xdm?  10:11   0.42s gdm-session-worker [pam/gdm-password]
    root     pts/0    183.63.119.37    22:29    1:07m  0.33s  0.30s -bash
    root     pts/1    183.63.119.37    22:35   39:46   2.66s  2.60s ssh centos2
    root     pts/2    183.63.119.25    22:38    2.00s  0.10s  0.00s w
    root     pts/3    183.63.119.37    22:52   38:50   0.27s  0.20s ssh centos1
    root     pts/4    183.63.119.37    23:01   56:42   0.07s  0.02s ssh centos1
    
    [root@centos6 mooc]# pkill -9 -t pts/1 
    [root@centos6 mooc]# pkill -9 -t pts/3
    [root@centos6 mooc]# pkill -9 -t pts/4
    [root@centos6 mooc]# w
     00:00:50 up 15:08,  3 users,  load average: 0.00, 0.01, 0.05
    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
    root     :0       :0               四08   ?xdm?  10:13   0.42s gdm-session-worker [pam/gdm-password]
    root     pts/0    183.63.119.37    22:29    1:09m  0.33s  0.30s -bash
    root     pts/2    183.63.119.25    22:38    2.00s  0.13s  0.01s w
    
    
    • 更改进程优先级
    nice -n -5 pid # only set when a servece is set up  
    
    工作管理
    • 将运行的进程放入后台

      • command &
      • top #按下ctl + z 快捷键 ,放在后台暂停
    • 查看后台工作

        `jobs [-l]`
      
    • 将后台暂停的工作恢复至前台

    fg %工作号
    

    *将工作恢复到后台运行

    bg %工作号
    
    • 脱离终端后,后台程序不停止
    nohup  command
    
    cat command >> /etc/rc.local
    
    系统资源查询
    • 查询系统重要资源
    vmstat 1
    
    • 检测内核信息
    dmesg
    
    • 查看内存状态
    free
    

    *查看cpu信息

    cat /proc/cpuinfo
    
    • 查看当前内核版本
    uname -a
    
    • 查看系统当前版本
    lsb_release -a 
    
    • 查看进程调用的文件
    lsof | more
    
    • 查看某个文件被哪个进程调用
    lsof /sbin/init
    
    • 查看http进程调用了哪些文件
    lsof -c httpd
    
    • 按照用户名,查询某用户的进程调用的文件
    lsof -u root
    
    系统定时任务
    • at 一次定时执行任务
    	at now +time
    
    • crond 服务管理与访问控制
    crontab -e 
    # 进入crontab 编辑界面,会打开你的编辑器
    *****执行的任务  
    
    • 查询定时

       crontab -l
      
    • 删除定时

    crontab -r
    
  • 相关阅读:
    JAVA实现图的邻接表以及DFS
    对于JAVA多线程卖票小程序的理解
    我的第一篇博客
    The 'with' and 'as' Keywords
    Buffering Data
    rstrip
    MapFields和并行计算(OpenFOAM)
    Python 调用自己编写的Class
    vs2013和vs2010的配置
    Eclipse的配置
  • 原文地址:https://www.cnblogs.com/Ethan2lee/p/7524268.html
Copyright © 2011-2022 走看看