dalance / procs Goto Github PK
View Code? Open in Web Editor NEWA modern replacement for ps written in Rust
License: MIT License
A modern replacement for ps written in Rust
License: MIT License
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`
Would you consider adding the ability to specify custom colors by rgb or hex notation? Thanks.
Reproduction
$ 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
$ 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
.
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
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.
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:
apk add procs
Enjoy! :)
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.
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
support eminence/procfs#47
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.
error[E0658]: imports can only refer to extern crate names passed with --extern
on stable channel (see issue #53130)
[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
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.)
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.
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.
4.9M root 1 May 10:14 /usr/bin/procs # non-LTO
3.8M root 1 May 10:28 /usr/bin/procs # LTO
echo "
[profile.release]
lto = true
codegen-units = 1
" >> Cargo.toml
also I haven't noticed any prolong compilation due to LTO enabled.
Reference:
[1] https://www.collabora.com/news-and-blog/blog/2020/04/28/reducing-size-rust-gstreamer-plugin/
When using a filter procs does not end a branch properly:
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)
procs --version
procs 0.9.20
The column description State
and Nice
could be shorter and waste space.
Would it be possible to reduce the space between columns?
But alas MS says that's not available on Windows 7:
https://docs.microsoft.com/en-gb/windows/desktop/apiindex/windows-apisets
This is more a historical record in case anyone else gets the same error message. I'm guessing the recommended fix for this is to upgrade one's OS...
Line 44 in c713f18
On a light colored terminal, these are invisible.
Related discussion and libraries that handle it in nushell/nushell#893.
I'm trying to install via cargo install
, but get compile error.
Which version of rustc
shall I use?
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):
git://git.alpinelinux.org/aports
is appropriate)abuild
group and it's registered (for root, you'll need to install shadow
and use newgrp
)aports/*/procs
abuild fetch unpack prepare build
(if root, you will need the -F
flag)abuild check
(see flag above) - this is the isolated "run tests" step, and will trigger even though tests are (currently) disabled.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
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?
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
.
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] │ │
RFE: Could it be possible to get it as Flatpak ? or RPM?
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`.```
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.
Run mocha tests. The 'procs -w' (interval 1 sec.) shows 'node' process CPU load more than 100%, while standard 'top' is none.
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.
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.
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
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.
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.
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
Running on xfce Manjaro latest version in xfce-terminal.
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
$ cat /etc/system-release
CentOS Linux release 7.4.1708 (Core)
$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
$ 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
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
It would be really great to be able to install procs on Windows through the windows package manager, winget
.
When entering watch mode, q and Ctrl-C are quit keys, but pressing Ctrl-C does not work on Windows.
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
0.9.18 rpm is not part of the release artifacts
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.