Skip to content

Chapter 5 of 7

Processes, Resources, and Shell Customization

Linux exposes the running programs on your system through processes. ps aux provides a snapshot of every process with details such as the owning user, CPU usage, and memory consumption. For a continuously updating, interactive view, top (or its more colorful cousin htop) is the tool of choice. To stop a misbehaving process, note its PID from ps or top and run kill PID for a polite termination request (SIGTERM), or kill -9 PID to force the issue with SIGKILL when the process refuses to stop.

Long-running tasks do not need to monopolize your terminal. Appending an ampersand to a command — for example, sleep 10 & — runs it in the background and frees the prompt for other work. The jobs command lists your current background jobs, while fg brings one back to the foreground and bg resumes a suspended job in the background. You can also revisit your earlier work with history, which lists previously entered commands; rerun any of them with !n (where n is the number shown) or !! to repeat the most recent one.

Aliases let you define custom shortcuts, such as alias ll='ls -l', and adding them to ~/.bashrc makes them persistent; after editing that file, run source ~/.bashrc to apply the changes immediately. To monitor system health, several utilities are available: free -h displays memory usage, uptime reports load averages, and vmstat provides a broader view of memory, CPU, and I/O activity. For disk space, df -h summarizes free space across mounted filesystems in human-readable form, while du -sh directory reports the size of a specific directory and its contents. The env command lists environment variables, and export VAR=value sets one for your shell and any processes it spawns — useful for configuring tools like editors or API keys.

All chapters
  1. 1Introduction to the Linux Command Line
  2. 2Navigating and Managing the Filesystem
  3. 3Inspecting and Editing Files
  4. 4Permissions, Searching, and Data Flow
  5. 5Processes, Resources, and Shell Customization
  6. 6Networking and Package Management
  7. 7Archiving, Compression, and Automation

Drill it

Reading is not remembering. These come from the Linux Command Line deck:

Q

What is the Linux command line interface (CLI)?

The Linux CLI is a text-based interface for interacting with the operating system using commands entered via a terminal emulator, allowing users to perform task...

Q

What is a shell in Linux?

A shell is a program that interprets commands entered into the CLI, processes them, and communicates with the kernel; common shells include Bash (Bourne Again S...

Q

How do you open a terminal in Linux?

Use keyboard shortcuts like Ctrl+Alt+T on Ubuntu or search for 'Terminal' in the applications menu; it launches a shell session for command execution.

Q

What does the <code>pwd</code> command do?

The pwd (Print Working Directory) command displays the absolute path of the current working directory, helping users confirm their location in the filesystem.