Coder Social home page Coder Social logo

procs's Introduction

procs

procs is a replacement for ps written in Rust.

Actions Status codecov

Changelog Crates.io procs homebrew

Documentation quick links

Features

  • Colored and human-readable output
    • Automatic theme detection based on terminal background
  • Multi-column keyword search
  • Some additional information which are not supported by ps
    • TCP/UDP port
    • Read/Write throughput
    • Docker container name
    • More memory information
  • Pager support
  • Watch mode (like top)
  • Tree view

Platform

  • Linux is supported.
  • macOS is experimentally supported.
    • macOS version is checked on GitHub Actions environment only.
    • The issues caused by real-machine are welcome.
  • Windows is supported.
  • FreeBSD is experimentally supported.

Installation

Download binary

Download from release page, and extract to the directory in PATH.

Packaging status

Nixpkgs

You can install from Nixpkgs.

nix-env --install procs

snapcraft

You can install from snapcraft.

sudo snap install procs

homebrew

You can install from homebrew.

brew install procs

MacPorts

You can install from MacPorts.

sudo port install procs

Alpine Linux

You can install from the Alpine Linux repository.

The correct repository (see above link for the most up-to-date information) should be enabled before apk add.

sudo apk add procs

Arch Linux

You can install from the Arch Linux extra repository.

sudo pacman -S procs

Scoop

You can install with scoop.

scoop install procs

Fedora

sudo dnf install procs

Windows

winget install procs

RPM

You can install with rpm.

sudo rpm -i https://github.com/dalance/procs/releases/download/v0.14.5/procs-0.14.5-1.x86_64.rpm

Cargo

You can install with cargo.

cargo install procs

Installation Notes

Permissions issues

On macOS, normal users can't access any information on other users' processes. On Linux, normal users can't access some information (ex. Read/Write throughput) of other users.

If you want to show this information, you should use sudo.

$ sudo procs
[sudo] password for ...:

If you want to skip password input, you can add the following entry to /etc/sudoers.

[user or group] ALL= NOPASSWD: [procs binary path]
// ex. myuser ALL= NOPASSWD: /usr/local/bin/procs

Usage

In the following screenshots, config/large.toml is used as the configuration.

Show all processes

Type procs only. It shows the information of all processes.

procs

procs

Search by non-numeric keyword

If you add any keyword as argument, it is matched to USER, Command by default.

procs zsh

If you want to add columns matching to non-numeric keyword, nonnumeric_search option can be used in configuration file.

procs_zsh

Search by numeric keyword

If a numeric is used as the keyword, it is matched to PID by default. Numeric is treated as exact match, and non-numeric is treated as partial match by default.

procs --or 6000 60000 60001 16723

If you want to add columns matching to numeric keyword, numeric_search option can be used in configuration file.

procs_port

Note that procfs permissions only allow identifying listening ports for processes owned by the current user, so not all ports will show up unless run as root.

Logical operation of search keywords

If there are some keywords, logical operation between the keywords can be specified by commandline option.

  • --and : The processes that match with all keywords are shown.
  • --or : The processes that match with any keyword are shown.
  • --nand: The processes are shown unless these match with all keywords.
  • --nor : The processes are shown unless these match with any keyword.

The default operation can be specified in the configuration file. See [search] section.

Show Docker container name

If you have access permission to docker daemon ( unix:///var/run/docker.sock ), Docker column is added.

procs growi

procs_docker

Note that procs gets the container information through UNIX domain socket, so Docker Toolbox on macOS (doesn't use UNIX domain socket) is not supported. Docker Desktop for Mac is supported but not tested.

Pager

If output lines exceed terminal height, pager is used automatically. This behavior and pager command can be specified by configuration file.

Linux / macOS

On Linux and macOS, less is the default pager. If there is not less, more is used. Instead of them, built-in pager can be used by configuration use_builtin.

Windows

On Windows, built-in pager is always used.

Watch mode

If --watch or --watch-interval <second> option is used, procs automatically updates output like top. If --watch is used, the update interval becomes 1s. The update interval can be specified by the argument of --watch-interval. There are some keyboard shortcuts to control.

  • n: Change the sort column to the next column
  • p: Change the sort column to the previous column
  • a: Change the sort order to ascending
  • d: Change the sort order to descending
  • q: Quit

Tree view

If --tree option is used, processes are sorted by dependency order and dependency tree is shown at left side.

procs --tree

procs_tree

If TreeSlot column exists in config, dependency tree is shown at the slot.

Sort column

Column sort order can be changed by --sorta or --sortd option. The last character of --sorta and --sortd means sort order: "a"scending and "d"escending.

The column for sort is selected by the option keyword. The keyword is matched with column kind that is shown by --list option. If --sorta cputime, column is sorted by CpuTime with ascending order. If --sortd rss, column is sorted by VmRss with descending order. The keyword is matched partially and case is ignored.

The default sort is specified by [sort] section in the configuration file.

procs --sortd cpu

procs_sort

Insert column

--insert option inserts new column to the position of Slot column or MultiSlot column. The column for insert is selected by the option keyword. The keyword is the same as sort option. A Slot column can be used by an inserted column. If many insertions are required, many Slot columns should be added. A MultiSlot column can be used by many inserted columns. If there is a MultiSlot, all the remaining columns are inserted to the MultiSlot, and the subsequent Slot / MultiSlot is not used. Unused Slot / MultiSlot is not shown.

Shell completion

--gen-completion option generates shell completion files under the current directory. The following shells are supported.

  • zsh
  • bash
  • fish
  • powershell
  • elvish

--gen-completion-out option generates shell completion to stdout. You can source it directly on some shells.

source <(procs --gen-completion-out bash)

Configuration

Configuration path

You can change configuration by writing a configuration file. There are some configuration examples in config directory of this repository. config/large.toml is the default configuration before procs v0.9.21.

The locations of the configuration file is OS-specific:

  • Linux: ~/.config/procs/config.toml, /etc/procs/procs.toml
  • macOS: ~/Library/Preferences/com.github.dalance.procs/config.toml, /etc/procs/procs.toml
  • Windows: ~/AppData/Roaming/dalance/procs/config/config.toml

For compatibility, if ~/.procs.toml exists, it will be preferred to the OS-specific locations.

Specify a configuration from command line

--use-config option can specify a built-in configuration. --load-config option can specify a configuration file path.

Configuration example

The complete example of a configuration file can be generated by --gen-config option.

[[columns]]
kind = "Pid"
style = "BrightYellow|Yellow"
numeric_search = true
nonnumeric_search = false

[[columns]]
kind = "Username"
style = "BrightGreen|Green"
numeric_search = false
nonnumeric_search = true
align = "Right"

[style]
header = "BrightWhite|Black"
unit = "BrightWhite|Black"
tree = "BrightWhite|Black"

[style.by_percentage]
color_000 = "BrightBlue|Blue"
color_025 = "BrightGreen|Green"
color_050 = "BrightYellow|Yellow"
color_075 = "BrightRed|Red"
color_100 = "BrightRed|Red"

[style.by_state]
color_d = "BrightRed|Red"
color_r = "BrightGreen|Green"
color_s = "BrightBlue|Blue"
color_t = "BrightCyan|Cyan"
color_z = "BrightMagenta|Magenta"
color_x = "BrightMagenta|Magenta"
color_k = "BrightYellow|Yellow"
color_w = "BrightYellow|Yellow"
color_p = "BrightYellow|Yellow"

[style.by_unit]
color_k = "BrightBlue|Blue"
color_m = "BrightGreen|Green"
color_g = "BrightYellow|Yellow"
color_t = "BrightRed|Red"
color_p = "BrightRed|Red"
color_x = "BrightBlue|Blue"

[search]
numeric_search = "Exact"
nonnumeric_search = "Partial"
logic = "And"

[display]
show_self = false
show_thread = false
show_thread_in_tree = true
cut_to_terminal = true
cut_to_pager = false
cut_to_pipe = false
color_mode = "Auto"

[sort]
column = 0
order = "Ascending"

[docker]
path = "unix:///var/run/docker.sock"

[pager]
mode = "Auto"

[[columns]] section

[[columns]] section defines which columns are used. The first [[columns]] is shown at left side, and the last is shown at right side.

Key Value Default Description
kind See kind list Column type
style See style list Column style
numeric_search true, false false Whether the column can be matched with numeric keywords
nonnumeric_search true, false false Whether the column can be matched with non-numeric keywords
align Left, Right, Center Left Text alignment
max_width [Number] Maximum column width
min_width [Number] Minimum column width
header [String] Alternate header description

kind list

procs kind ps STANDARD FORMAT Description Linux macOS Windows FreeBSD
Ccgroup -not supported- Control group by compressed format o
Cgroup cgroup Control group o
Command args Command with all arguments o o o o
ContextSw -not supported- Context switch count o o o
CpuTime cputime Cumulative CPU time o o o o
Docker -not supported- Docker container name o o
Eip eip Instruction pointer o
ElapsedTime -not supported- Elapsed time o o o o
Env e output modifier Environment variables o o
Esp esp Stack pointer o
FileName comm File name o o
Gid egid Group ID o o o o
GidFs fgid File system group ID o
GidReal rgid Real group ID o o o
GidSaved sgid Saved group ID o o o
Group egroup Group name o o o o
GroupFs fgroup File system group name o
GroupReal rgroup Real group name o o o
GroupSaved sgroup Saved group name o o o
MajFlt maj_flt Major page fault count o o o o
MinFlt min_flt Minor page fault count o o o
MultiSlot -not supported- Slot for --insert option o o o o
Nice ni Nice value o o o
Pgid pgid Process group ID o o o
Pid pid Process ID ( or Thread ID sorrunded by [] ) o o o o
Policy policy Scheduling policy o o
Ppid ppid Parent process ID o o o o
Priority pri Priority o o o o
Processor psr Currently assigned processor o o
ReadBytes -not supported- Read bytes from storage o o o o
RtPriority rtprio Real-time priority o
SecContext label Security context o
Separator -not supported- Show | for column separation o o o o
Session sid Session ID o o o
ShdPnd pending Pending signal mask for process o o
SigBlk blocked Blocked signal mask o o
SigCgt caught Caught signal mask o o
SigIgn ignored Ignored signal mask o o
SigPnd pending Pending signal mask for thread o
Slot -not supported- Slot for --insert option o o o o
Ssb -not supported- Speculative store bypass status o
StartTime start_time Starting time o o o o
State s Process state o o o
TcpPort -not supported- Bound TCP ports o o
Threads nlwp Thread count o o o
TreeSlot -not supported- Slot for tree column o o o o
Tty tty Controlling TTY o o o
UdpPort -not supported- Bound UDP ports o o
Uid euid User ID o o o o
UidFs fuid File system user ID o
UidLogin -not supported- Login user ID o
UidReal ruid Real user ID o o o
UidSaved suid Saved user ID o o o
UsageCpu %cpu CPU utilization o o o o
UsageMem %mem Memory utilization o o o o
User euser User name o o o o
UserFs fuser File system user name o
UserLogin -not supported- Login user name o
UserReal ruser Real user name o o o
UserSaved suser Saved user name o o o
VmData -not supported- Data size o o
VmExe trs Text segments size o o
VmHwm -not supported- Peak resident set size o o o
VmLib -not supported- Library code size o
VmLock -not supported- Locked memory size o
VmPeak -not supported- Peak virtual memory size o o
VmPin -not supported- Pinned memory size o o
VmPte -not supported- Page table entries size o
VmRss rss Resident set size o o o o
VmSize vsz Physical page size o o o o
VmStack -not supported- Stack size o o
VmSwap -not supported- Swapped-out virtual memory size o o
Wchan wchan Process sleeping kernel function o o
WorkDir -not supported- Current working directory o
WriteByte -not supported- Write bytes to storage o o o o

style list

  • BrightBlack
  • BrightRed
  • BrightGreen
  • BrightYellow
  • BrightBlue
  • BrightMagenta
  • BrightCyan
  • BrightWhite
  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Magenta
  • Cyan
  • White
  • Color256
  • ByPercentage
  • ByState
  • ByUnit

There are some special styles like ByPercentage, ByState, ByUnit. These are the styles for value-aware coloring. For example, if ByUnit is chosen, color can be specified for each unit of value ( like K, M, G,,, ). The colors can be configured in [style.by_unit] section.

Other colors can be configured as the same as color.

[style] section

[style] section defines colors of header, unit and each styles. The available list of color is below.

Subsection Key Value Default Description
header See color list BrightWhite|Black Header color
unit See color list BrightWhite|Black Unit color
tree See color list BrightWhite|Black Tree color
by_percentage color_000 See color list BrightBlue|Blue Color at 0% - 25%
by_percentage color_025 See color list BrightGreen|Green Color at 25% - 50%
by_percentage color_050 See color list BrightYellow|Yellow Color at 50% - 75%
by_percentage color_075 See color list BrightRed|Red Color at 75% - 100%
by_percentage color_100 See color list BrightRed|Red Color at 100% -
by_state color_d See color list BrightRed|Red Color at D state
by_state color_r See color list BrightGreen|Green Color at R state
by_state color_s See color list BrightBlue|Blue Color at S state
by_state color_t See color list BrightCyan|Cyan Color at T state
by_state color_z See color list BrightMagenta|Magenta Color at Z state
by_state color_x See color list BrightMagenta|Magenta Color at X state
by_state color_k See color list BrightYellow|Yellow Color at K state
by_state color_w See color list BrightYellow|Yellow Color at W state
by_state color_p See color list BrightYellow|Yellow Color at P state
by_unit color_k See color list BrightBlue|Blue Color at unit K
by_unit color_m See color list BrightGreen|Green Color at unit M
by_unit color_g See color list BrightYellow|Yellow Color at unit G
by_unit color_t See color list BrightRed|Red Color at unit T
by_unit color_p See color list BrightRed|Red Color at unit P
by_unit color_x See color list BrightBlue|Blue Color at other unit

color list

  • BrightBlack
  • BrightRed
  • BrightGreen
  • BrightYellow
  • BrightBlue
  • BrightMagenta
  • BrightCyan
  • BrightWhite
  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Magenta
  • Cyan
  • White
  • Color256

Colors can be configured by theme through |.

style = "BrightWhite|Black" # BrightWhite for dark theme and Black for light theme
style = "BrightWhite"       # BrightWhite for both theme

The first color is for dark theme, and the second is for light theme. If only a color is specified, the color is applied to both theme.

Color256 can be specified by 0-255 value like below:

style = "223|112" # 223 for dark theme and 112 for light theme
style = "223"     # 223 for both theme

[search] section

[search] section defines option for Keyword search.

Key Value Default Description
numeric_search Exact, Partial Exact Whether numeric keywords match exactly or partially
nonnumeric_search Exact, Partial Partial Whether non-numeric keywords match exactly or partially
logic And, Or, Nand, Nor And Logical operation between keywords
case Smart, Insensitive, Sensitive Smart Case sensitivity in search

case

case is case sensitivity in search.

  • Smart: If keyword contains uppercase character, case sensitive search. Otherwise case insensitive search
  • Insensitive: case insensitive search
  • Sensitive: case sensitive search

[display] section

[display] section defines option for output display.

Key Value Default Description
show_self true, false false Whether the self process ( procs ) is shown
show_self_parents true, false false Whether the parents which have self as the only child process are shown
show_thread true, false false Whether the thread information is shown ( Linux only )
show_thread_in_tree true, false true Whether the thread information is shown in tree mode ( Linux only )
show_parent_in_tree true, false true Whether the parent process is shown in tree mode
show_children_in_tree true, false true Whether the children processes are shown in tree mode
show_header true, false true Whether header row is shown
show_footer true, false false Whether footer row is shown
show_kthreads true, false true Whether processes which belong to kthread are shown ( Linux only )
cut_to_terminal true, false true Whether output lines are truncated for output into terminal
cut_to_pager true, false false Whether output lines are truncated for output into pager
cut_to_pipe true, false false Whether output lines are truncated for output into pipe
color_mode Auto, Always, Disable Auto The default behavior of output coloring without --color commandline option
separator [String] String used as Separator
ascending [String] Ascending sort indicator
descending [String] Descending sort indicator
tree_symbols [String; 5] [│, ─, ┬, ├, └] Symbols used by tree view
abbr_sid true, false true Whether machine SID is abbreviated ( Windows only )
theme Auto, Dark, Light Auto Default theme

If color_mode is Auto, color is enabled for terminal and pager, disabled for pipe.

If theme is Auto, theme is detected from terminal automatically. Some terminal don't support the automatic detection, so Dark or Light can be specified explicitly.

abbr_sid

Windows SID is too long, so it is abbreviated by default. If abbr_sid is false, SID is fully shown like below:

S-1-5-21-789457439-2186958450-1652286173-1001

If abbr_sid is true, SID is shown like below:

S-1-5-21-...-1001

[sort] section

[sort] section defines the column used for sort and sort order.

Key Value Default Description
column [Number] 0 Column number to used for sort
order Ascending, Descending Ascending Sort order

If column is 0, value is sorted by the left column.

[docker] section

[docker] section defines how to communicate to docker daemon.

Key Value Default Description
path [Path] unix:///var/run/docker.sock UNIX domain socket to docker daemon

[pager] section

[pager] section defines the behavior of pager.

Key Value Default Description
mode Auto, Always, Disable Auto The default behavior of pager usage without --pager commandline option
detect_width true, false false Whether auto mode detects terminal width overflow
use_builtin true, false false Whether built-in pager is used
command [Command] less -SR Pager command

If mode is Auto, pager is used only when output lines exceed terminal height. Default pager is less -SR ( if less is not found, more -f ).

procs's People

Contributors

auronandace avatar azureqaq avatar chenrui333 avatar cristiano-prato avatar cuishuang avatar dalance avatar dcarosone avatar dependabot-preview[bot] avatar dependabot[bot] avatar dufferzafar avatar facundoacevedo avatar functionalhacker avatar github-actions[bot] avatar guettli avatar hamflx avatar ignatenkobrain avatar kianmeng avatar liff avatar marcograss avatar mwilliammyers avatar onurkader avatar orhun avatar palfrey avatar peamaeq avatar riveascore avatar sagittarius-a avatar sorairolake avatar sou-chon avatar soumil-07 avatar whynothugo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

procs's Issues

Escaped characters(?) in output for PID and CPU.

image

I'm getting odd escaped characters or something in my output for PID and CPU columns. Unsure where to start to troubleshoot this.

bdmorin@phester:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

inconsistent segfaults in the test suite

When running tests in the packaging process, sometimes, a test will fail with a segfault (invalid memory reference).
I analyzed what was happening, but couldn't come to a definitive conclusion.

Would it be possible to investigate this?
For now tests are disabled for packaging purposes (since it wouldn't be nice to require continual re-runs until it passes), but it would be nice to be able to re-enable them.

To reproduce (note: this is inconsistent, both on where it fails and whether if fails):

  1. Launch an alpine vm/container/system/whatever (ideally edge)
  2. Install alpine-sdk
  3. Clone the alpine ports tree (depth=1 is fine for this purpose; it can be found in multiple places, and may actually move soon (a transition to gitlab is currently ongoing); at the time of writing, git://git.alpinelinux.org/aports is appropriate)
  4. Ensure your user is part of the abuild group and it's registered (for root, you'll need to install shadow and use newgrp)
  5. Enter aports/*/procs
  6. Run abuild fetch unpack prepare build (if root, you will need the -F flag)
  7. Run abuild check (see flag above) - this is the isolated "run tests" step, and will trigger even though tests are (currently) disabled.

Column sizing

The column widths seem to be calculated from the full dataset, rather than the subset that will actually get displayed.

image

(I expected cupsd to show up listening on 631, and don't really understand why it doesn't, but that's a separate issue once I figure out what's up)

rustc version

I'm trying to install via cargo install, but get compile error.
Which version of rustc shall I use?

List of children processes

When matching a process procs usually shows parent processes of the matched process. It would be nice to have a mode to see child processes like pstree 1234 does (and/or parent and child processes combined), perhaps only in tree mode. This is useful for example to show list of all nginx processes by pointing to a master.

What do you think?

Crash when sorting and tree view

hi,

when i do a procs --sortd cpu --tree i get

thread 'main' panicked at 'no entry found for key', src/libcore/option.rs:1038:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Do we need the note about config file is not found?

After running procs I get the following note. Do we need this?

note: configuration file (/Users/shinokada/Library/Preferences/com.github.dalance.procs/config.toml) is not found
      please see https://github.com/dalance/procs#configuration
procs --version
procs 0.10.1

Tree view doesn't work on macOS when run as root

Running procs -t works as expected as a regular user, but running sudo procs -t running procs -t with the setuid bit set results in no processes being listed:

REDACTED:~ elyscape$ sudo procs -t
  PID User │ State Nice TTY CPU MEM  VmSize   VmRSS TCP UDP  Read Write │ CPU Time Start Docker │ Command
           │                [%] [%] [bytes] [bytes]         [B/s] [B/s] │                       │

Not building on 1.31.1

error[E0658]: imports can only refer to extern crate names passed with --extern on stable channel (see issue #53130)

Feature request: Process tree

Feature request: Process tree based on parent process id in the same style as process explorer.

It's great to see visually which process owns which.

Can't run 0.4.5

Hello there,
Thank you for this interesting program.
Can't run 0.4.5 on Linux x86_64.

$ RUST_BACKTRACE=1 ./procs 
thread 'main' panicked at 'Failed to unwrap map.remove("Umask"). Please report this as a procfs bug.', /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/procfs-0.4.5/src/process.rs:1346:59
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:491
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:398
   6: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:353
   7: procfs::process::Status::from_reader
   8: procfs::process::Process::status
   9: procs::run_opt_config
  10: procs::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  15: main

Running 0.4.4 OK, but there are odd empty between lines

 PID   User       | State Nice TTY   CPU MEM  VSZ      RSS      TCP    UDP Read  Write | CPU Time Start            | Command                                                                                                        
                                                                                                                                                                                                                                    
                                                                                     
                  |                  [%] [%]  [bytes]  [bytes]             [B/s] [B/s] |                           |                                                                                                                
                                                                                                                                                                                                                                    
                                                                                     
 1     root       | S     0          0.0 0.2  217.703M 9.344M                          | 00:00:05 2019/02/15 18:37 | /usr/lib/systemd/systemd --switched-root --system --deserialize 24                                             
                                                                                                                                                                                                                                    
                                                                                     
 2     root       | S     0          0.0 0.0  0        0                               | 00:00:00 2019/02/15 18:37 | kthreadd                                                                                                       
                                                                                                                                                                                                                                    
                                                                                     
 4     root       | S     -20        0.0 0.0  0        0                               | 00:00:00 2019/02/15 18:37 | kworker/0:0H                                                                                                   
 

E0308 error with rustc 1.11.0-nightly (2019-11-16)

error[E0308]: mismatched types
  --> /home/lucius/.cargo/registry/src/github.com-1ecc6299db9ec823/procs-0.8.13/src/./columns/uid_login.rs:37:44
   |
37 |         self.raw_contents.insert(proc.pid, raw_content);
   |                                            ^^^^^^^^^^^ expected i32, found u32
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
   |
37 |         self.raw_contents.insert(proc.pid, raw_content.try_into().unwrap());
   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There are many errors regarding the type of raw_content.

Possible to reorder columns?

This wasn't clear to me from reading the README, but is it possible to reorder the columns? The default order has the process name off the edge of the screen, which makes it kind of difficult to use in a standard sized terminal.

Panic at start

Reproduction

Click to expand
$ export RUST_BACKTRACE=full && procs
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Failed to parse patch version"', src/libcore/result.rs:1084:5
stack backtrace:
   0:     0x55756d533a2b - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x55756d533a2b - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x55756d533a2b - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x55756d533a2b - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x55756d533a2b - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x55756d533706 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x55756d53419d - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x55756d533d22 - std::panicking::continue_panic_fmt::h25abfbb4e5b7043a
                               at src/libstd/panicking.rs:384
   8:     0x55756d533c06 - rust_begin_unwind
                               at src/libstd/panicking.rs:311
   9:     0x55756d5540dd - core::panicking::panic_fmt::h7e9f94035af782b3
                               at src/libcore/panicking.rs:85
  10:     0x55756d5541d7 - core::result::unwrap_failed::hf7591c1dd9412006
                               at src/libcore/result.rs:1084
  11:     0x55756d51a216 - procfs::read_value::h70a8ff1975a3c93a
  12:     0x55756d517200 - std::sync::once::Once::call_once::{{closure}}::hadc97d58692f4440
  13:     0x55756d530a28 - std::sync::once::Once::call_inner::hd4f4cc742be97eac
                               at src/libstd/sync/once.rs:392
  14:     0x55756d503545 - procfs::process::Stat::from_reader::h28f3fd54348fb299
  15:     0x55756d50d951 - procfs::process::Process::new::h61a59629ef0fe709
  16:     0x55756d510440 - procfs::process::all_processes::h923c0e72a0b03083
  17:     0x55756d363a92 - procs::process::linux::collect_proc::h667da0c79d421ec6
  18:     0x55756d3fa0c4 - procs::gen_columns::h56dcbd5bb859276c
  19:     0x55756d401278 - procs::run::h710be2ae681f2ff3
  20:     0x55756d3fc152 - procs::main::hc6baa929f9ca3929
  21:     0x55756d406213 - std::rt::lang_start::{{closure}}::he8b7288d0c12e9d6
  22:     0x55756d533ba3 - std::rt::lang_start_internal::{{closure}}::h4e93c1949c7a1955
                               at src/libstd/rt.rs:49
  23:     0x55756d533ba3 - std::panicking::try::do_call::h9440ccd4dc467eaa
                               at src/libstd/panicking.rs:296
  24:     0x55756d53b6aa - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  25:     0x55756d5346ad - std::panicking::try::hc046e7ee42ee744f
                               at src/libstd/panicking.rs:275
  26:     0x55756d5346ad - std::panic::catch_unwind::h27dfc457c200aee0
                               at src/libstd/panic.rs:394
  27:     0x55756d5346ad - std::rt::lang_start_internal::hea1b49a567afe309
                               at src/libstd/rt.rs:48
  28:     0x55756d405562 - main
  29:     0x7f2904487deb - __libc_start_main
                               at ../csu/libc-start.c:308
  30:     0x55756d34d17a - _start
  31:                0x0 - <unknown>

System information

Click to expand
$ uname -a
Linux a 5.2.19_1 #1 SMP PREEMPT Sun Oct 6 07:54:23 UTC 2019 x86_64 GNU/Linux
$ procs --version
procs 0.8.10

Other information

procs was installed with cargo install procs.

Default value for watch

Version: procs 0.9.2

Behaviour:

$ procs -w
error: The argument '--watch <second>' requires a value but none was supplied

Expectation:

Start watching immediately with a default value, but leave it to the user to specify a value if wanted. This behaviour is quite common with established linux/unix commands that support a watch mode, or *watch` itself.

Failed to build with rustc 1.35.0

Env

$ cat /etc/system-release
CentOS Linux release 7.4.1708 (Core)

$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)

Command

$ cargo install procs

   Compiling console v0.7.5
   Compiling procfs v0.5.2
   Compiling cookie v0.2.5
   Compiling structopt v0.2.17
   Compiling hyper v0.9.18
   Compiling palaver v0.2.1
error[E0308]: mismatched types
  --> /home/AD/yukinari.tani/.cargo/registry/src/github.com-1ecc6299db9ec823/palaver-0.2.1/src/valgrind.rs:15:39
   |
15 |     let err = unsafe { libc::getrlimit64(resource, &mut rlim) };
   |                                          ^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
  --> /home/AD/yukinari.tani/.cargo/registry/src/github.com-1ecc6299db9ec823/palaver-0.2.1/src/valgrind.rs:33:23
   |
33 |     let rlim = getrlimit(libc::RLIMIT_NOFILE).unwrap();
   |                          ^^^^^^^^^^^^^^^^^^^ expected i32, found u32

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `palaver`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `procs v0.8.5`, intermediate artifacts can be found at `/tmp/cargo-installot988m`

Caused by:
  build failed

CPU usage more than 100%

Run mocha tests. The 'procs -w' (interval 1 sec.) shows 'node' process CPU load more than 100%, while standard 'top' is none.

Extract libproc to separate library (macos)

Do you have any plans to extract your version of libproc implementation to separate library? I know there exists one already, but your version seems to have much more features implemented.
I'm looking for ability to get information about cpu/memory usage of some process tree in my project

Won't build on macOS

error[E0433]: failed to resolve: could not find `linux` in `os`
 --> /Users/cdhagmann/.cargo/registry/src/github.com-1ecc6299db9ec823/procfs-0.4.5/src/process.rs:8:14
  |
8 | use std::os::linux::fs::MetadataExt;
  |              ^^^^^ could not find `linux` in `os`

error[E0599]: no method named `st_uid` found for type `std::fs::Metadata` in the current scope
    --> /Users/cdhagmann/.cargo/registry/src/github.com-1ecc6299db9ec823/procfs-0.4.5/src/process.rs:1525:23
     |
1525 |             owner: md.st_uid(),
     |                       ^^^^^^
     |
     = help: items from traits can only be used if the trait is in scope
     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
             `use std::os::macos::fs::MetadataExt;`

error[E0599]: no method named `st_uid` found for type `std::fs::Metadata` in the current scope
    --> /Users/cdhagmann/.cargo/registry/src/github.com-1ecc6299db9ec823/procfs-0.4.5/src/process.rs:1540:23
     |
1540 |             owner: md.st_uid(),
     |                       ^^^^^^
     |
     = help: items from traits can only be used if the trait is in scope
     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
             `use std::os::macos::fs::MetadataExt;`

error: aborting due to 3 previous errors

Some errors occurred: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: Could not compile `procfs`.```

Packaging: Alpine Linux

Hi, procs is now available in the official Alpine Linux repos.
I'm not sure how you want installation instructions formatted, so here is a summary:

  1. Ensure that the correct repository (see above link for the most up-to-date information) is enabled.
  2. apk add procs

Enjoy! :)

Filter by tcp-port is in Readme, but not in default configuration

Readme says:

If a numeric is used as the keyword, it is matched to PID, TCP, UDP by default

But in reality, this filtering doesn't work by default and user has to create config-file and add TcpPort, UdpPort columns to it.

I'm not sure what would be the best solution here. It can be rewording of Readme which leads user to custom config or it can be tweaking of implicit (default) configuration

failed to install in FreeBSD jail

[alexr@dev ~]$ cargo install procs
Updating crates.io index
Downloaded procs v0.9.18
Downloaded 1 crate (57.4 KB) in 0.71s
Installing procs v0.9.18
error: failed to compile procs v0.9.18, intermediate artifacts can be found at /tmp/cargo-installZMHAko

Caused by:
failed to select a version for the requirement quote = "= 1.0.2"
candidate versions found which didn't match: 1.0.3, 1.0.1, 1.0.0, ...
location searched: crates.io index
required by package procs v0.9.18

Reconsider dependencies

unbytify is not really maintained, would be nice to replace it with something else.

And if you could make the dockworker the optional component, would be very nice.

On-the-fly sorting via keyboard shortcut?

Hi, would it be possible to be able change sorting 'on-the-fly' via a keyboard shortcut or a similar method?
Ie. say for example Alt+S once, sort by User,
Alt+S again, sort / 'cycle' to the next available column...
Ctrl could maybe further be used for ascending / descending order on whatever 'selected' column.

Just a generic suggestion, hopefully i'm making sense above :-)
Basically a way to switch view fast to the top possible 'offenders',
without having to q, procs --sortd rss, q, procs --sorta tcpport etc...

All the best

suid feature is insecure

The suid feature does not scrub the environment or do permission checks, like sudo does. This means you can elevate your permissions fairly easily provided you can run a suided proc and can make an executable file. Example:

baduser@localhost$ (ln -s /usr/bin/nano sudo; PATH=$PWD:$PATH /usr/local/bin/procs --suid)
# edit /etc/sudoers using nano to add "baduser ALL=(ALL:ALL) NOPASSWD: ALL"
baduser@localhost$ sudo id
uid=0(root) gid=0(root) groups=0(root)

Suggested fix: Remove the feature and instruct users to use sudo. Perhaps provide an example rule and alias/wrapper like this:

root# echo "%admins ALL= NOPASSWD: /usr/local/bin/procs" > /etc/sudoers
root# gpasswd -a myuser admins
myuser$ sudo procs # works
baduser$ sudo procs # fails

Tree view: branch does not end properly when using filter

When using a filter procs does not end a branch properly:

Bildschirmfoto von 2020-01-28 18-36-12

On the left you see how htop display the last child in a sub tree when filtered (F4) and on the right procs.

htop:

├─ /usr/…
│  ├─
│  ├─
│  └─  ← this here

procs:

 │││└┬────
 │││ ├────
 │││ ├────
 │││ ├──── ← not very nice :(

(I am also not sure if the tree is at the correct column. htops visualization in front of the command make more sense IMHO)

homebrew v0.9.16 upgrade issue

relates to Homebrew/homebrew-core#51035

==> cargo install --locked --root /usr/local/Cellar/procs/0.9.16 --path .
Last 15 lines from /Users/ruichen/Library/Logs/Homebrew/procs/01.cargo:
   Compiling regex v1.3.4
   Compiling idna v0.1.5
error: failed to run custom build command for `proc-macro-error-attr v0.4.10`

Allow Black as a color

I use a Solarized Light theme for most of my terminals, so it would be great to allow Black as a color (which I'd use in place of White everywhere.)

Flatpak ?

RFE: Could it be possible to get it as Flatpak ? or RPM?

Default pager cuts off rightmost columns in small terminal

When running procs without any arguments, the default pager of less is now launched. This is great ! However, when the number of column of the terminal is less than required to display the full width of the table, everything to the right of that will be cut off, This tends to lose the most important column, Command.

it's possible to work around this using:

procs --color always | less -SR

…which launches a pager that is able to scroll left/right to see all the information. But I think it would be useful to have this as default.

Please provide a default config to start from

Currently if you have no config, you have all columns. For example if one of your apps opens many ports, you have gigantic list of ports, forcing all command out of our screen.

Commands should be closer. So I try to write a config, but a moment I create a config I am empty handed. The app won't even start with empty columsn list.

One way it is to start from the config from README, but it has too few columns to start with, now I have to list them all.

I wonder if we could start wil full config as default and do cosmetic changes on it.

Clear screen on watch exit

When exiting any command starting with procs -w, q and C-c leaves the contents of the last watched screen refresh on the terminal and places the cursor at the top. This causes the shell prompt to be printed over the top of this, which can make it hard to find. My current workaround is to type C-l a lot.

Please support ~/.config/procs/config.toml on macOS

Most command line tools on macOS also place their config files under ~/.config. This makes things much simpler when you share your dotfiles between multiple machine. I suggest defaulting to ~/.config/procs/config.toml if ~/Library/Preferences/com.github.dalance.procs/config.toml isn't found. Thank you.

ps minimalistic by default

For users coming from ps getting the most used options to simply run (ie only showing PID TTY TIME CMD) would be useful.
The output is a bit overwhelming in size and it is not clear to me from the start how to reduce the columns or select only some of them.

tree + filter: an option to show full branches

currently, whenever I run procs --tree postgres I can see only the items which actually have "postgres" in their title. This is fine for normal mode, but…

It would be really useful if in tree mode the output would also include parent and child processes. Probably they could be shown in faded colors.

The main point of tree-mode is to show the context and I expect to be able to see this context even if filtering is involved.

To put it in other terms: in tree-mode, filter should be applied to branches, not leaves

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.