top を使用して CMD 名のみを表示する方法

top を使用して CMD 名のみを表示する方法

topCMD名のみを表示する方法は?

topたとえば、私が望む実行中のプロセスだけを表示するためにこれを使用しました。

$ top -p 19745

複数のPIDが必要な場合は、次を使用します。

$ top -p 19745 -p 19746 -p 19747

グーグルをしてみましたが、どうするか教えてくれませんし、ヘルプを探してもtopまだ教えてくれません。

CMD名でのみフィルタリングする方法はありますか?

私はApache2を介していくつかのファイルを実行しており、監視だけをしたいと思います。

afile1.abc
afile2.abc
afile3.abc
afile4.abc

修正する

私はページでこれを見るman top

x: Command  --  Command line or Program name
      Display the command line used to start a task or the name of the associated
      program.   You toggle between command line and name with 'c', which is both
      a command-line option and an interactive command.

      When you've chosen to display command lines, processes  without  a  command
      line  (like  kernel  threads)  will  be shown with only the program name in
      parentheses, as in this example:
            ( mdrecoveryd )

      Either form of display is subject to potential truncation if it's too  long
      to fit in this field's current width.  That width depends upon other fields
      selected, their order and the current screen width.

      Note: The 'Command' field/column is unique, in that it is not  fixed-width.
      When  displayed,  this  column will be allocated all remaining screen width
      (up to the maximum 512 characters) to provide for the potential  growth  of
      program names into command lines.

これは私に役立ちますか?

ベストアンサー1

フィルタリングをサポートしている場合は、次の対話型コマンドをtop開始して入力します。top

oCOMMAND=afile

フィールド名はCOMMANDすべて大文字でなければなりません。

マニュアルページから:

5e. FILTERING in a Window
   You can use the 'Other Filter' feature to establish selection cri‐
   teria which will then determine which tasks are shown in the ´cur‐
   rent´ window.

   Establishing a filter requires: 1) a field name; 2)  an  operator;
   and  3) a selection value, as a minimum.

   Filter Basics
      .  field names are case sensitive and spelled as in the header
      .  selection values need not comprise the full displayed field
      .  separate unique filters are maintained for each task window

Keyboard Summary
     o  :Other-Filter (lower case)
         You will be prompted to establish a filter that ignores case
         when matching.

     O  :Other-Filter (upper case)
         You will be prompted to establish a case sensitive filter.

おすすめ記事