国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學習啦>學習電腦>操作系統(tǒng)>Linux教程>

    Linux中查看進程及殺死進程命令

    時間: 志藝942 分享

      Linu_中想殺死fcit_的進程,然后再重啟它。下面是小編為大家收集的Linu_中查看進程及殺死進程命令,希望能幫到大家。

      Linu_中查看進程及殺死進程命令

      root@www.linu_idc.com:/home/zhangbin# ps -e | grep 'fcit_'

      3405 ? 00:00:00 fcit_

      3415 ? 00:00:02 fcit_

      不顯示標題

      root@www.linu_idc.com:/home/zhangbin# ps -h

      Warning: bad ps synta_, perhaps a bogus '-'? See http://procps.sf.net/faq.html

      929 tty4 Ss+ 0:00 /sbin/getty -8 38400 tty4

      936 tty5 Ss+ 0:00 /sbin/getty -8 38400 tty5

      945 tty2 Ss+ 0:00 /sbin/getty -8 38400 tty2

      946 tty3 Ss+ 0:00 /sbin/getty -8 38400 tty3

      949 tty6 Ss+ 0:00 /sbin/getty -8 38400 tty6

      1096 tty1 Ss+ 0:00 /sbin/getty -8 38400 tty1

      3303 tty8 Ss+ 0:28 /usr/bin/_ :0 -br -verbose -auth /var/run/gdm/auth-fo

      3590 pts/0 S 0:00 su

      3598 pts/0 S 0:00 bash

      3621 pts/0 S 0:00 dbus-launch --autolaunch 3153116c74ee72bf74da76a44d30

      3787 pts/0 R+ 0:00 ps -h

      顯示所有進程

      root@www.linu_idc.com:/home/zhangbin# ps -e

      PID TTY TIME CMD

      1 ? 00:00:00 init

      2 ? 00:00:00 kthreadd

      3 ? 00:00:00 migration/0

      4 ? 00:00:00 ksoftirqd/0

      5 ? 00:00:00 watchdog/0

      6 ? 00:00:00 events/0

      7 ? 00:00:00 cpuset

      8 ? 00:00:00 khelper

      9 ? 00:00:00 netns

      10 ? 00:00:00 async/mgr

      11 ? 00:00:00 pm

      12 ? 00:00:00 sync_supers

      13 ? 00:00:00 bdi-default

      14 ? 00:00:00 kintegrityd/0

      15 ? 00:00:00 kblockd/0

      16 ? 00:00:00 kacpid

      17 ? 00:00:00 kacpi_notify

      18 ? 00:00:00 kacpi_hotplug

      19 ? 00:00:00 ata/0

      20 ? 00:00:00 ata_au_

      21 ? 00:00:00 ksuspend_usbd

      22 ? 00:00:00 khubd

      23 ? 00:00:00 kseriod

      24 ? 00:00:00 kmmcd

      27 ? 00:00:00 khungtaskd

      28 ? 00:00:00 kswapd0

      29 ? 00:00:00 ksmd

      30 ? 00:00:00 aio/0

      31 ? 00:00:00 ecryptfs-kthrea

      32 ? 00:00:00 crypto/0

      39 ? 00:00:00 scsi_eh_0

      40 ? 00:00:00 scsi_eh_1

      42 ? 00:00:00 kstriped

      43 ? 00:00:00 kmpathd/0

      44 ? 00:00:00 kmpath_handlerd

      45 ? 00:00:00 ksnapd

      46 ? 00:00:00 kondemand/0

      47 ? 00:00:00 kconservative/0

      252 ? 00:00:00 khpsbpkt

      254 ? 00:00:00 knodemgrd_0

      262 ? 00:00:00 jbd2/sda10-8

      263 ? 00:00:00 e_t4-dio-unwrit

      296 ? 00:00:00 flush-8:0

      323 ? 00:00:00 upstart-udev-br

      327 ? 00:00:00 udevd

      539 ? 00:00:00 kpsmoused

      637 ? 00:00:00 i915

      640 ? 00:00:00 jbd2/sda11-8

      643 ? 00:00:00 e_t4-dio-unwrit

      652 ? 00:00:00 pccardd

      654 ? 00:00:00 ipw2200/0

      655 ? 00:00:00 udevd

      681 ? 00:00:00 udevd

      683 ? 00:00:00 ktpacpid

      738 ? 00:00:00 jbd2/sda8-8

      739 ? 00:00:00 e_t4-dio-unwrit

      778 ? 00:00:00 rsyslogd

      787 ? 00:00:01 dbus-daemon

      799 ? 00:00:00 gdm-binary

      805 ? 00:00:00 avahi-daemon

      807 ? 00:00:00 NetworkManager

      809 ? 00:00:00 avahi-daemon

      818 ? 00:00:00 modem-manager

      822 ? 00:00:00 console-kit-dae

      903 ? 00:00:00 wpa_supplicant

      929 tty4 00:00:00 getty

      936 tty5 00:00:00 getty

      945 tty2 00:00:00 getty

      946 tty3 00:00:00 getty

      949 tty6 00:00:00 getty

      951 ? 00:00:00 acpid

      955 ? 00:00:00 anacron

      960 ? 00:00:00 cron

      961 ? 00:00:00 atd

      996 ? 00:00:00 cupsd

      1096 tty1 00:00:00 getty

      1135 ? 00:00:00 upowerd

      1139 ? 00:00:00 rtkit-daemon

      1143 ? 00:00:00 polkitd

      1291 ? 00:00:00 pulseaudio

      1304 ? 00:00:00 gconf-helper

      1316 ? 00:00:00 udisks-daemon

      1317 ? 00:00:00 udisks-daemon

      1434 ? 00:20:10 backend

      1506 ? 00:00:00 system-service-

      3252 ? 00:00:00 sh

      3254 ? 00:00:00 run-parts

      3258 ? 00:00:00 apt-_apian-inde

      3259 ? 00:00:08 update-apt-_api

      3294 ? 00:00:00 gdm-simple-slav

      3303 tty8 00:00:29 _org

      3324 ? 00:00:00 dbus-launch

      3339 ? 00:00:00 gdm-session-wor

      3356 ? 00:00:00 gnome-keyring-d

      3374 ? 00:00:00 gnome-session

      3405 ? 00:00:00 fcit_

      3409 ? 00:00:00 ssh-agent

      3412 ? 00:00:00 dbus-launch

      3413 ? 00:00:00 dbus-daemon

      3415 ? 00:00:03 fcit_

      3417 ? 00:00:00 gconfd-2

      3424 ? 00:00:00 gnome-settings-

      3426 ? 00:00:00 gvfsd

      3431 ? 00:00:00 gvfs-fuse-daemo

      3435 ? 00:00:00 gnome-power-man

      3437 ? 00:00:00 bluetooth-apple

      3438 ? 00:00:02 gnome-panel

      3439 ? 00:00:03 compiz

      3440 ? 00:00:00 nautilus

      3442 ? 00:00:00 nm-applet

      3444 ? 00:00:00 polkit-gnome-au

      3449 ? 00:00:00 syndaemon

      3452 ? 00:00:00 gvfs-gdu-volume

      3463 ? 00:00:00 gvfs-afc-volume

      3466 ? 00:00:00 gvfs-gphoto2-vo

      3468 ? 00:00:00 gvfsd-trash

      3470 ? 00:00:00 bonobo-activati

      3512 ? 00:00:00 trashapplet

      3513 ? 00:00:02 wnck-applet

      3526 ? 00:00:00 sh

      3527 ? 00:00:00 gtk-window-deco

      3535 ? 00:00:00 clock-applet

      3536 ? 00:00:00 indicator-apple

      3537 ? 00:00:00 indicator-apple

      3538 ? 00:00:00 notification-ar

      3544 ? 00:00:00 gvfsd-metadata

      3546 ? 00:00:00 indicator-appli

      3548 ? 00:00:00 indicator-messa

      3550 ? 00:00:00 indicator-sound

      3555 ? 00:00:00 indicator-sessi

      3557 ? 00:00:00 gvfsd-burn

      3559 ? 00:00:00 indicator-me-se

      3562 ? 00:00:00 gnome-screensav

      3568 ? 00:00:00 gdu-notificatio

      3571 ? 00:00:00 gnome-terminal

      3572 ? 00:00:00 gnome-pty-helpe

      3573 pts/0 00:00:00 bash

      3590 pts/0 00:00:00 su

      3598 pts/0 00:00:00 bash

      3610 ? 00:00:00 evolution-alarm

      3611 ? 00:00:00 python

      3616 ? 00:00:00 cat

      3621 pts/0 00:00:00 dbus-launch

      3622 ? 00:00:00 dbus-daemon

      3658 ? 00:00:00 update-notifier

      3678 ? 00:00:08 chrome

      3681 ? 00:00:00 chrome

      3683 ? 00:00:00 chrome

      3741 ? 00:00:11 chrome

      3766 ? 00:00:02 chrome

      3779 ? 00:00:00 aptd

      3789 pts/0 00:00:00 ps

      全格式,顯示終端上的進程。

      root@www.linu_idc.com:/home/zhangbin# ps -f

      UID PID PPID C STIME TTY TIME CMD

      root 3590 3573 0 23:43 pts/0 00:00:00 su

      root 3598 3590 0 23:43 pts/0 00:00:00 bash

      root 3621 1 0 23:43 pts/0 00:00:00 dbus-launch --autolaunch 3153116

      root 3790 3598 0 23:53 pts/0 00:00:00 ps -f

      顯示終端上的所有進程

      root@www.linu_idc.com:/home/zhangbin# ps -a

      PID TTY TIME CMD

      3590 pts/0 00:00:00 su

      3598 pts/0 00:00:00 bash

      3621 pts/0 00:00:00 dbus-launch

      3791 pts/0 00:00:00 ps

      顯示所有者的信息

      root@www.linu_idc.com:/home/zhangbin# ps -u

      Warning: bad ps synta_, perhaps a bogus '-'? See http://www.linu_idc.com /faq.html

      USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

      root 929 0.0 0.0 1792 464 tty4 Ss+ 23:20 0:00 /sbin/getty -8

      root 936 0.0 0.0 1792 468 tty5 Ss+ 23:20 0:00 /sbin/getty -8

      root 945 0.0 0.0 1792 468 tty2 Ss+ 23:20 0:00 /sbin/getty -8

      root 946 0.0 0.0 1792 468 tty3 Ss+ 23:20 0:00 /sbin/getty -8

      root 949 0.0 0.0 1792 468 tty6 Ss+ 23:20 0:00 /sbin/getty -8

      root 1096 0.0 0.0 1792 468 tty1 Ss+ 23:20 0:00 /sbin/getty -8

      root 3303 4.4 2.7 29932 20688 tty8 Ss+ 23:42 0:33 /usr/bin/_ :0 -

      root 3590 0.0 0.2 4692 1636 pts/0 S 23:43 0:00 su

      root 3598 0.0 0.2 4784 1852 pts/0 S 23:43 0:00 bash

      root 3621 0.0 0.0 3384 744 pts/0 S 23:43 0:00 dbus-launch --a

      root 3792 0.0 0.1 2716 1048 pts/0 R+ 23:55 0:00 ps -u
      統(tǒng)計當前進程數(shù)目

      root@www.linu_idc.com:/home/zhangbin# ps -au_ | wc

      Warning: bad ps synta_, perhaps a bogus '-'? See http://www.linu_idc.com /faq.html

      154 1830 15628

      root@www.linu_idc.com:/home/zhangbin# ps -au_ | wc -l

      Warning: bad ps synta_, perhaps a bogus '-'? See http://www.linu_idc.com /faq.html

      154

      過濾特定進程數(shù)目

      root@www.linu_idc.com:/home/zhangbin# ps au_ | grep httpd | wc -l

      1

      root@www.linu_idc.com:/home/zhangbin# ps au_ | grep httpd | wc

      1 13 89

      ======================

      ps命令最常用的還是用于監(jiān)控后臺進程的工作情況,因為后臺進程是不和屏幕鍵盤這些標準輸入/輸出設備進行通信的,所以如果需要檢測其情況,便可以使用ps命令了.

      ps [選項]

      下面對命令選項進行說明∶

      -e顯示所有進程.

      -f全格式.

      -h不顯示標題.

      -l長格式.

      -w寬輸出.

      a顯示終端上的所有進程,包括其他用戶的進程.

      r只顯示正在運行的進程.

      _顯示沒有控制終端的進程.

      O[+|-] k1 [,[+|-] k2 [,&hellip;]] 根據SHORT KEYS、k1、k2中快捷鍵指定的多 級排序順序顯示進程列表.對于ps的不同格式都存在著默認的順序指定.這些默 認順序可以被用戶的指定所覆蓋.其中&ldquo;+&rdquo;字符是可選的,&ldquo;-&rdquo;字符是倒轉指 定鍵的方向.

      平時-

      最常用的三個參數(shù)是u、a、_.

      選項 功能介紹

      -a 顯示所有終端中的進程。注意只有與終端關聯(lián)的進程才會顯示,那些守護進程或沒有和終端關聯(lián)的將不被顯示。

      -_ 顯示那些不關聯(lián)終端的進程。

      -u 顯示進程所有者的信息

      -f 顯示進程的父進程信息

      -o 對ps指令顯示的信息進行定制,例如:pid、comm、%cpu、%mem、state、tty、euser、ruser

      root@www.linu_idc.com:/home/zhangbin# ps -ef | grep fcit_

      zhangbin 3405 3374 0 Feb20 ? 00:00:00 [fcit_]

      zhangbin 3415 1 0 Feb20 ? 00:00:06 /usr/bin/fcit_

      root 3843 3598 0 00:08 pts/0 00:00:00 grep --color=auto fcit_

      1.作用

      kill命令用來中止一個進程。

      2.格式

      kill [ -s signal | -p ] [ -a ] pid &hellip;

      kill -l [ signal ]

      3.參數(shù)

      -s:指定發(fā)送的信號。

      -p:模擬發(fā)送信號。

      -l:指定信號的名稱列表。

      pid:要中止進程的ID號。

      Signal:表示信號。

      4.說明

      進程是Linu_系統(tǒng)中一個非常重要的概念。Linu_是一個多任務的操作系統(tǒng),系統(tǒng)上經常同時運行著多個進程。我們不關心這些進程究竟是如何分配的,或 者是內核如何管理分配時間片的,所關心的是如何去控制這些進程,讓它們能夠很好地為用戶服務。

      Linu_操作系統(tǒng)包括三種不同類型的進程,每種進程都有自己的特點和屬性。交互進程是由一個Shell啟動的進程。交互進程既可以在前臺運行,也 可以在后臺運行。批處理進程和終端沒有聯(lián)系,是一個進程序列。監(jiān)控進程(也稱系統(tǒng)守護進程)時Linu_系統(tǒng)啟動時啟動的進程,并在后臺運行。例 如,httpd是著名的Apache服務器的監(jiān)控進程。

      kill命令的工作原理是,向Linu_系統(tǒng)的內核發(fā)送一個系統(tǒng)操作信號和某個程序的進程標識號,然后系統(tǒng)內核就可以對進程標識號指定的進程進行操 作。比如在top命令中,我們看到系統(tǒng)運行許多進程,有時就需要使用kill中止某些進程來提高系統(tǒng)資源。系統(tǒng)多個虛擬控制臺的作用是當一個程序出錯造成 系統(tǒng)死鎖時,可以切換到其它虛擬控制臺工作關閉這個程序。此時使用的命令就是kill,因為kill是大多數(shù)Shell內部命令可以直接調用的。

      5.應用實例

      (1)強行中止(經常使用殺掉)一個進程標識號為324的進程:

      #kill -9 324

      (2)解除Linu_系統(tǒng)的死鎖

      在Linu_中有時會發(fā)生這樣一種情況:一個程序崩潰,并且處于死鎖的狀態(tài)。此時一般不用重新啟動計算機,只需要中止(或者說是關閉)這個有問題的程序即 可。當kill處于_-Window界面時,主要的程序(除了崩潰的程序之外)一般都已經正常啟動了。此時打開一個終端,在那里中止有問題的程序。比如, 如果Mozilla瀏覽器程序出現(xiàn)了鎖死的情況,可以使用kill命令來中止所有包含有Mozolla瀏覽器的程序。首先用top命令查處該程序的 PID,然后使用kill命令停止這個程序:

      #kill -SIGKILL___

      其中,___是包含有Mozolla瀏覽器的程序的進程標識號。

      (3)使用命令回收內存

      我們知道內存對于系統(tǒng)是非常重要的,回收內存可以提高系統(tǒng)資源。kill命令可以及時地中止一些&ldquo;越軌&rdquo;的程序或很長時間沒有相應的程序。例如,使用 top命令發(fā)現(xiàn)一個無用 (Zombie) 的進程,此時可以使用下面命令:

      #kill -9___

      其中,___是無用的進程標識號。

      然后使用下面命令:

      #free

      此時會發(fā)現(xiàn)可用內存容量增加了。

      (4)killall命令

      Linu_下還提供了一個killall命令,可以直接使用進程的名字而不是進程標識號,例如:

      # killall -HUP inetd

      _死進程最安全的方法是單純使用kill命令,不加修飾符,不帶標志。

      首先使用ps -ef命令確定要殺死進程的PID,然后輸入以下命令:

      # kill -pid

      注釋:標準的kill命令通常都能達到目的。終止有問題的進程,并把進程的資源釋放給系統(tǒng)。然而,如果進程啟動了子進程,只殺死父進程,子進程仍在 運行,因此仍消耗資源。為了防止這些所謂的&ldquo;僵尸進程&rdquo;,應確保在殺死父進程之前,先殺死其所有的子進程。

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _定要殺死進程的PID或PPID

      # ps -ef | grep httpd

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _優(yōu)雅的方式結束進程

      # kill -l PID

      -l選項告訴kill命令用好像啟動進程的用戶已注銷的方式結束進程。當使用該選項時,kill命令也試圖殺死所留下的子進程。但這個命令也不是總 能成功&ndash;或許仍然需要先手工殺死子進程,然后再殺死父進程。

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _ERM信號

      給父進程發(fā)送一個TERM信號,試圖殺死它和它的子進程。

      # kill -TERM PPID

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _illall命令

      killall命令殺死同一進程組內的所有進程。其允許指定要終止的進程的名稱,而非PID。

      # killall httpd

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _止和重啟進程

      有時候只想簡單的停止和重啟進程。如下:

      # kill -HUP PID

      該命令讓Linu_和緩的執(zhí)行進程關閉,然后立即重啟。在配置應用程序的時候,這個命令很方便,在對配置文件修改后需要重啟進程時就可以執(zhí)行此命 令。

      &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash;

      _殺 kill -9 PID

      同意的 kill -s SIGKILL

      這個強大和危險的命令迫使進程在運行時突然終止,進程在結束后不能自我清理。危害是導致系統(tǒng)資源無法正常釋放,一般不推薦使用,除非其他辦法都無 效。

      當使用此命令時,一定要通過ps -ef確認沒有剩下任何僵尸進程。只能通過終止父進程來消除僵尸進程。如果僵尸進程被init收養(yǎng),問題就比較嚴重了。殺死init進程意味著關閉系統(tǒng)。

      如果系統(tǒng)中有僵尸進程,并且其父進程是init,而且僵尸進程占用了大量的系統(tǒng)資源,那么就需要在某個時候重啟機器以清除進程表了。


    看了&ldquo;Linu_中查看進程及殺死進程命令&rdquo;還想看:

    1.linu_系統(tǒng)常用基本命令

    2.Linu_常用命令大全

    3.windows怎么使用命令查看和終止進程

    4.linu_中怎么顯示所有進程

    5.linu_如何查看端口被哪個進程占用的方法

    6.Linu_有什么進程管理命令

    2864952