< linuxtable_01_001.html > < indextable01.htm > < index.html >

tack Developers Group Homepage!

<<< pskill_01_001.html >>>

徐々にLinuxに慣れていく。コマンドひとつひとつ覚えていく。第一弾: ps/kill

2023R05-0418-TUE-2100
コマンド:

・Task Manager like

top

Ctrl-cで停止。

[[[ Getting pids from ps -ef |grep keyword ]]]
pidを得ないとkillできない。pidを得るためには?

・linux - Getting pids from ps -ef |grep keyword - Stack Overflow
https://stackoverflow.com/questions/8120304/getting-pids-from-ps-ef-grep-keyword

How to Find the Pid of a Linux Process With pidof or pgrep
https://www.howtogeek.com/846713/find-pid-of-process-linux/

ps -ef | grep firefox
pgrep -f firefox

・linux - Killing processes in Raspbian - Super User
https://superuser.com/questions/872244/killing-processes-in-raspbian

プロセスを終了するkillコマンドの使い方まとめ!【Linuxコマンド集】
https://eng-entrance.com/linux-command-kill

kill -9 <pid>
kill -kill <pid>
kill -s SIGKILL <pid>

・【便利なLinuxコマンド】pkill (同じプロセス名をまとめてkill)
https://zenn.dev/en2enzo2/articles/e6c1b94f2ae599

pkill <process name>

文字列で検索して該当するものをみんな終了する。

・Raspbianでフリーズ! ターミナルモードでプロセスをkillして復旧する - やってみる
https://ytyaru.hatenablog.com/entry/2019/07/18/000000

1. ターミナルモードで起動する(Ctrl+Alt+F2)
2. ログインする
3. プロセスidを一覧する
4. 対象プロセスをkillする
5. Windowモードに戻る(Ctrl+Alt+F7)

ps ax
ps aux --sort -rss

・【 more 】コマンド――長いメッセージやテキストファイルを1画面ずつ表示する:Linux基本コマンドTips(2) - @IT
https://atmarkit.itmedia.co.jp/ait/articles/1602/26/news027.html

ps aux --sort -rss | more

"|" is shift+¥

Spaceとかで進むのかな?Ctrl+xで停止。

・まとめ

基本的に、pgrep <文字列>でpidを得られる。
例えば、

pgrep firefox

で、出たpidを

kill <pid>

でkillします。

(2023R05-0429-SAT-1333 firefoxを例にしているのは、firefoxをkillしたらChromiumを巻き込んで終了したので。あと、ビージー状態で放っておいたらスリープし、そのままOSを巻き込んでフリーズしたというのが理由ですwそれ以外の意図はありません。)

(2023R05-0430-SUN-1421 フリーズしても、『ワークスペースの切り替え』でデスクトップを切り替えられるのかな?Ctrl+Alt+[矢印]。)


CC BY tDG.