Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Shells
    • Strings
    • System
    • Viewers

ps for system

View information about system processes.

Command Type

built-in

Signature

> ps {flags}

Flags

  • --long, -l: List all available columns for each entry.

Input/output types:

inputoutput
nothingtable

Examples

List the system processes

> ps

List the top 5 system processes with the highest memory usage

> ps | compact mem | sort-by mem | last 5

List the top 3 system processes with the highest CPU usage

> ps | compact cpu | sort-by cpu | last 3

List the 3 system processes that have used the most CPU time

> ps | compact cpu_time | sort-by cpu_time | last 3

List the system processes with 'nu' in their names

> ps | where name =~ 'nu'

Get the parent process id of the current nu process

> ps | where pid == $nu.pid | get ppid

Notes

The columns are the same on every platform. cpu is the percent of one CPU core the process used during a short (about 100ms) sample, like top shows, and cpu_time is the total CPU time it has used since it started. mem is resident memory.

With --long, virtual is the size of the process's virtual address space and private is the memory only it uses, the number Activity Monitor and Task Manager show as "Memory". read and written count bytes of storage I/O since the process started; on Windows they count all I/O, including pipes and network. user_id is the numeric user id on unix and the SID string (for example S-1-5-18) on Windows. Windows has priority classes rather than nice values, so its nice is the priority class on the nice scale, the way libuv and Node.js map it, and its process_group_id is the console process group.

A column is null when the operating system doesn't make that value available for a process: for example, macOS only shows the CPU, memory, threads, environment and working directory of other users' processes to root (their command is the executable's path), and the BSDs count disk I/O in blocks rather than bytes. Null sorts after every number and can't be matched with =~, so use compact to drop those rows before sorting or matching text.