Code Monkey home page Code Monkey logo

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

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

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.)

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.

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)

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.

rustc version

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

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

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

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

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)

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)

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! :)

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

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.

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?

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

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.

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.

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

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`.```

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.

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.

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] │                       │

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.

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`

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.

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

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

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.

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.

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                                                                                                   
 

Flatpak ?

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

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.

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.

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.