Chapter 6. Step 6: What’s Going On?

You have now learned how to navigate around, look inside files, and find files and search their contents. In this chapter and the next, I show you how to determine real-time system state, with an eye toward clues that may point to underlying problems.

It’s All Part of the Process

The ps (process) command shows running processes, akin to the Windows Task Manager, as you can see in Figure 6-1.

ps command
Figure 6-1. ps command

By default, ps shows only the processes for the current user. In the preceding example, the active processes are the Bash shell and the ps command itself.

If you want to see all running processes, you add the -A parameter. To make it pretty and show the hierarchical relationship between parent and child processes, you add -H:

ps -AH | less

Figure 6-2 shows the output.

ps -AH command
Figure 6-2. ps -AH command

Here you see many child processes running under init, which is typically the first process that runs (note that the left column shows init has a process ID of 1). Also notice that under a series of sshd (SSH daemon, or service, processes) is our bash session running ps, which is piping output to less.

Who’s on top?

The top command (Figure 6-3) shows processes sorted by resource consumption. It updates every few seconds, similar to Windows Task ...

Get Ten Steps to Linux Survival now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.