Poznawanie procesów: `ps`, `top`, `htop`
Poznają Państwo polecenia służące do wyświetlania, monitorowania i analizowania aktywnych procesów w systemie Linux.
Poznawanie procesów: `ps`, `top`, `htop` to bezpłatna lekcja Linux Command Line Mastery na CoddyKit. To lekcja 1 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Linux Command Line Mastery, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Linux Command Line Mastery zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
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.
psMore `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 auxDeciphering `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.
topNavigating `top`
top is interactive! Here are some basic keys:
- Press
qto quit. - Press
Mto sort processes by memory usage. - Press
Pto sort processes by CPU usage (default). - Press
kto "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).
htopWhy 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. Useps auxorps -effor comprehensive lists.top: Provides a real-time, interactive view of processes, sorted by resource usage.htop: An enhanced, more user-friendly version oftopwith visual bars, mouse support, and easier navigation.
These tools are essential for any Linux user!
Często zadawane pytania
Czy lekcja „Poznawanie procesów: `ps`, `top`, `htop`” jest bezpłatna?
Tak — pełny tekst „Poznawanie procesów: `ps`, `top`, `htop`” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Linux Command Line Mastery, przejdź na CoddyKit PRO. Kurs Linux Command Line Mastery zawiera 4 lekcji w sumie.
Co nauczysz się w „Poznawanie procesów: `ps`, `top`, `htop`”?
Poznają Państwo polecenia służące do wyświetlania, monitorowania i analizowania aktywnych procesów w systemie Linux. Ćwiczysz Linux Command Line Mastery z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć Linux Command Line Mastery?
Nie wymagamy żadnego doświadczenia. Linux Command Line Mastery w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 1 z 4.
Ile czasu zajmuje lekcja „Poznawanie procesów: `ps`, `top`, `htop`”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji Linux Command Line Mastery?
Tak. Każda lekcja Linux Command Line Mastery zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Poznawanie procesów: `ps`, `top`, `htop`
- Zarządzanie procesami: `kill`, `bg`, `fg`
- Monitorowanie zasobów systemowych: `df`, `du`, `free`
- Priorytety procesów za pomocą nice, renice i sygnałów