0Pricing
Linux Command Line Mastery · レッスン

プロセスの理解:`ps`、`top`、`htop`

Linuxシステムで実行中のプロセスを表示、監視し、その状態を理解するコマンドを学びます。

「プロセスの理解:`ps`、`top`、`htop`」はCoddyKit上の無料Linux Command Line Masteryレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはLinux Command Line Mastery学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Linux Command Line Masteryコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What Are Processes?

Welcome! In this lesson, we'll explore how to view and monitor programs running on your Linux system. These running programs are called processes.

Understanding processes is crucial for system administration, troubleshooting, and managing resource usage.

`ps`: Snapshot of Processes

The simplest way to see active processes is with the ps command. It gives you a snapshot of current processes.

By default, ps shows processes owned by your user in the current terminal session.

ps

More `ps` Details: `aux` and `-ef`

To see all processes on the system, including those owned by other users and system processes, we use options like aux or -ef.

  • a: Show processes for all users.
  • u: Display user/owner.
  • x: Show processes without a controlling terminal.

The -ef option is a common alternative on some systems, providing similar comprehensive output.

ps aux

Deciphering `ps` Output

When you run ps aux, you'll see several columns:

  • USER: The owner of the process.
  • PID: The unique Process ID.
  • %CPU: CPU usage percentage.
  • %MEM: Memory usage percentage.
  • CMD: The command that started the process.

These details help you identify what's running and by whom.

PID and PPID Explained

Every process has a unique PID (Process ID). It's like a social security number for a process.

Many processes are started by other processes. The process that starts another is called its parent process. The child process will have a PPID (Parent Process ID) that matches the parent's PID.

This creates a process tree, showing how processes are related.

ps -o pid,ppid,cmd

`top`: Real-time Monitoring

While ps gives a snapshot, top provides a dynamic, real-time view of your system's processes.

It continuously updates, showing CPU and memory usage, uptime, and a list of processes sorted by CPU usage (by default).

This is great for spotting processes consuming a lot of resources.

top

Navigating `top`

top is interactive! Here are some basic keys:

  • Press q to quit.
  • Press M to sort processes by memory usage.
  • Press P to sort processes by CPU usage (default).
  • Press k to "kill" a process (you'll need the PID).

Remember to be careful when using k!

`htop`: An Enhanced `top`

htop is an improved, interactive process viewer that's often preferred over top due to its user-friendliness.

It offers a more colorful and intuitive interface, making it easier to see CPU and memory usage visually.

You might need to install it first (e.g., sudo apt install htop on Debian/Ubuntu).

htop

Why Use `htop`?

htop provides several advantages:

  • Visual Bars: Clear graphs for CPU, memory, and swap.
  • Scrolling: Easily scroll horizontally and vertically.
  • Mouse Support: Click to sort columns or select processes.
  • Easy Filtering/Searching: Quickly find specific processes.
  • Tree View: See process hierarchy clearly.

It's a powerful tool for monitoring system health.

Process Command Check

You've learned about ps, top, and htop. Let's see if you can distinguish their primary uses.

Processes: Snapshot vs. Real-time

Great job! You now understand how to monitor processes on Linux.

  • ps: Gives a static snapshot of processes. Use ps aux or ps -ef for comprehensive lists.
  • top: Provides a real-time, interactive view of processes, sorted by resource usage.
  • htop: An enhanced, more user-friendly version of top with visual bars, mouse support, and easier navigation.

These tools are essential for any Linux user!

よくある質問

「プロセスの理解:`ps`、`top`、`htop`」レッスンは無料ですか?

はい。「プロセスの理解:`ps`、`top`、`htop`」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Linux Command Line Masteryコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Linux Command Line Masteryコースには全4レッスンが含まれています。

「プロセスの理解:`ps`、`top`、`htop`」で何を学びますか?

Linuxシステムで実行中のプロセスを表示、監視し、その状態を理解するコマンドを学びます。 ブラウザで直接実行するハンズオンコードでLinux Command Line Masteryを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Linux Command Line Masteryを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのLinux Command Line Masteryは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「プロセスの理解:`ps`、`top`、`htop`」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このLinux Command Line Masteryレッスンでコードを書いて実行できますか?

はい。すべてのLinux Command Line Masteryレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. プロセスの理解:`ps`、`top`、`htop`
  2. プロセスの管理:`kill`、`bg`、`fg`
  3. システムリソースの監視:`df`、`du`、`free`
  4. nice、renice、シグナルでプロセス優先度を扱う
← Linux Command Line Masteryに戻る