zoukankan      html  css  js  c++  java
  • ubuntu进程管理的一些命令

    查看进程:
    ps -e
    显示PID TTY TIME 及 CMD

    查看网络服务
    sudo netstat -antup

    杀死进程
    1、sudo kill 7082(PID)
    2、也可以使用killall命令。killall可以使用程序的名称,譬如输入:
    killall firefox
    3、如果前两者还是杀不死,用 kill -9 pid 命令,来绝杀

    pgrep 查找条件匹配的进程

    用法:pgrep[选项][程序名]

    主要选项如下。

    -l:列出程序名和进程ID。

    -o:进程起始的ID。

    -n:进程终止的ID。

    前后台相关

    1、在Linux终端运行命令的时候,在命令末尾加上 & 符号,就可以让程序在后台运行

    root@Ubuntu$ ./tcpserv01 &

    2、如果程序正在前台运行,可以使用 Ctrl+z 选项把程序暂停,然后用 bg %[number] 命令把这个程序放到后台运行

    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$ ./tcpserv01
    ^Z
    [1]+  Stopped                 ./tcpserv01
    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$ bg %1
    [1]+ ./tcpserv01 &
    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$

    3、对于所有运行的程序,我们可以用jobs –l 指令查看

    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$ jobs -l
    [1]+  4524 Running                 ./tcpserv01 &

    4、也可以用 fg %[number] 指令把一个程序掉到前台运行

    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$ fg %1
    ./tcpserv01

    5、也可以直接终止后台运行的程序,使用 kill 命令

    cat@Ubuntu:~/unp/unpv13e/tcpcliserv$ kill %1
  • 相关阅读:
    pandas 之 set_index
    python string 之 format
    python 数组反序的方法
    python之dict
    python string 之 format, join, split
    Kalman Filter
    python 读取 xlsx
    python pandas 对各种文件的读写 IO tools
    Sorting Rows In pandas Dataframes
    python---time 相关, str 转timestamp
  • 原文地址:https://www.cnblogs.com/zhengzhencai/p/3460789.html
Copyright © 2011-2022 走看看