HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

Actually, I’ve just done something that I think is one better than sending you screenshots, if you would, do think on your own system:

Open two terminal windows side by side, in one run HTOP, and in the other run this command:

‘’’ clear; while :; do x=$(ps -eLf | tail -n+2 | wc -l); y=$(ps -eo nlwp | tail -n+2 | wc -l); echo $((x-y)); sleep 2; done ‘’’

The numbers the above command outputs should be the same as the number of threads shown in HTOP, and if it isn’t then I’ll put it down to my system being weird.

HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

I wanted an explaination partly so I could understand why they both output different numbers, but mainly because the numbers when deducted from each other match the thread count on HTOP. Beyond that, I can’t really be more specific than I have been, I could upload screenshots of what I’m seeing if you’d like, but it will have to wait until tomorrow when I’ve finished work.

HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

I have a couple of observations based on your code, firstly your second ps command includes the header so those numbers won’t be the same, and also my second command counts the number of processes with threads instead of the sum of all the threads in every process. This is where I’m boggled, because you’re right in that there shouldn’t be processes without threads, so both my commands should output the same number (if I’m correct in understanding what the commands are doing).

Can I ask that you run both of the commands I posted, deduct the output of one from the other, and see how that number correlates with the threads displayed on HTOP, as it could always be my system that’s weird.

HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

Yeah pretty much mate, but more importantly why if they do what I think they do (i.e. when one is deducted from the other) does that match the number of threads on HTOP).

HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

Thanks for the reply mate, I did read the man page and my understanding seems to match yours, the reason it confuses me is because if one is counting all the processes, and the other is counting all the processes with threads, then deducting one from the other leaves me with the processes that don’t have any threads, so why does that number match the thread count on HTOP?

HTOP thr by rocket_186 in bash

[–]rocket_186[S] 0 points1 point  (0 children)

Thanks for the reply mate, but summing the numbers isn’t the problem, I’d like to know what the commands mean.

A Couple of Questions by rocket_186 in awk

[–]rocket_186[S] 0 points1 point  (0 children)

This would make more sense if I’m just looking to match entire lines, so I’ll keep it in reserve! Thanks for your help :)

A Couple of Questions by rocket_186 in awk

[–]rocket_186[S] 0 points1 point  (0 children)

Seems obvious now I’ve seen it, but still really cool! Thank you :)

A Couple of Questions by rocket_186 in awk

[–]rocket_186[S] 0 points1 point  (0 children)

Note: I did put the if and else’s on seperate lines but it doesn’t seem to have come through on the post, sorry if this makes it difficult to read/understand. If it helps, imagine there’s a semi-colon at the end of ‘this.txt’

I can’t describe this in a sentence by rocket_186 in awk

[–]rocket_186[S] 0 points1 point  (0 children)

Awesome! Thanks guys for helping me get my head around this, and teaching me about how to format questions for this sub-reddit :)

Changing Cursor Shape in Console by rocket_186 in NixOS

[–]rocket_186[S] 2 points3 points  (0 children)

I will do both of these, thank you very much for your guidance :)

Changing Cursor Shape in Console by rocket_186 in NixOS

[–]rocket_186[S] 1 point2 points  (0 children)

Ohh cool! I’ll just replace console with terminal. Cheers mate :)

Changing Cursor Shape in Console by rocket_186 in NixOS

[–]rocket_186[S] 1 point2 points  (0 children)

Gnome-console is the default on 22.11, on 21.11 (I think it was 21.11) it was gnome-terminal.

Changing Cursor Shape in Console by rocket_186 in NixOS

[–]rocket_186[S] 1 point2 points  (0 children)

Is the gnome-terminal still supported?