You are not logged in.

#1 2017-11-13 18:14:34

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

Note: Read first several posts before utilizing this how-to.


Don't know if BL already comes with it or not, if it does if it's the latest etc. So may as well cover this. I've got it setup on my main OS but only have it installed on my backup gnu/Nix install. As such this will help me, hopefully you if you have any interest.

Ps_mem is just basically a simple python script to monitor core memory use and which processes are using that RAM. I like it and have come to believe it's preferable to "free -m". With that out of the way, let's do this.

Install the python-pip package. Allows for easy install of many different python type things.

sudo apt-get install python-pip

Then install ps_mem with it.

sudo pip install ps_mem

Wham... done, to run it "sudo ps_mem", however this is kind of tedious and having to enter your password just to see memory stats isn't great. Let's do it an easier way. Open visudo ... First make your user root.

sudo su

then

visudo

The visudo file opens in the default cli-editor you have, though also note it even says in the file, it's better to add edits to sudoers.d file or whichever. Rather than doing it here, I don't do much to it, so I did it there/visudo. Add the following. To the section shown below.

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
yourusername ALL=(ALL:ALL)ALL
yourusername ALL=(ALL) NOPASSWD: /usr/local/bin/ps_mem

Ok the NOPASSWD let's you run ps_mem w/o password which is getting warmer, however you still have to append it with sudo, I don't like that so time to fix this by adding an alias in the .bash_aliases file stashed in your users /home directory.

Unhide the .dot files/folders in thunar-etc, however you want to do it. I tend to just use the keyboard shortcut, Ctrl/Control + h press it once to unhide, you press it again to hide them again. Anyway I added the alias as follows, one alias per line in the file. Here's mine by way of example of course name yours whatever ya please.

alias mem="sudo /usr/local/bin/ps_mem"

That's a wrap, now when I enter "mem" in terminal it runs ps_mem for me without need of adding sudo or entering my password. Nope ... not so fast, one more refinement here. You'll have to logout back in your user for it to take effect, I just do that in terminal "openbox --exit". Which takes me to my lightdm greeter screen, log back in ...  now this is finished.


Vll! smile

Last edited by BLizgreat! (2017-11-13 22:26:33)

Offline

#2 2017-11-13 18:59:49

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

Added babble bonus, there's also this if you wanted to browse through additional python modules which could be installed with python-pip. Think it's a fairly interesting piece of software itself, so why not point the above out too. At the moment don't have much knowledge about it. Just found it myself, so no particular recommendations as to anything cool/useful to install with it other than I do like ps_mem, shrugs. There's also this resource on the topic.

Hmmmm this is a job-question for SUPER HOAS!!!

VlHoas! smile

Last edited by BLizgreat! (2017-11-13 19:12:58)

Offline

#3 2017-11-13 20:56:37

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

I don't trust pip so I install ps_mem with

mkdir ~/git && cd ~/git
git clone https://github.com/pixelb/ps_mem.git
cp ps_mem/ps_mem.py ~/bin/ps-mem && chmod +x ~/bin/ps-mem

Then use `sudo ps-mem` to run it  smile

EDIT: note that no superuser privileges are needed for my method  angel

Last edited by Head_on_a_Stick (2017-11-13 20:58:12)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#4 2017-11-13 21:40:12

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

^ Cool nothing wrong with an add of relevant info. smile Was actually trying to incorporate a bit of extra nixishness into the how-to, for whoever would be interested. Not sure about python pip either overall. It's listed as one of the methods on the maintainer's github page. Not that such should be considered any great endorsement.

Curious, any elaboration on how/why you don't trust it Hoas ? Technical ( as in may not install stuff correctly etc), don't trust as in do not trust the people who made the software ? Both ? I mean it's in the Debian repo's, would they allow harmful-ware to be so readily available ?

To end this babble ... really not sure of any of that. Vll! smile

Last edited by BLizgreat! (2017-11-13 21:41:14)

Offline

#5 2017-11-13 21:45:11

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

BLizgreat! wrote:

any elaboration on how/why you don't trust it

You are comfortable with running the pip package manager as root and letting it loose on your system to do as it pleases?

I am not.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#6 2017-11-13 21:55:35

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

Only for some select stuff ... yeah I guess. Though honestly didn't do much looking into it prior to usage. However in this case, though as always respect your views, was hoping for something substantial or tangible to base an objection to using it on. Many nixers in my experience and view are verging on paranoid when it comes to privacy/security on their systems.

Not that, that's a terrible thing in and of itself. Just noticed there's a tendency to take it too far imo, shrugs. Not saying you are, you know what you like and trust and whatcha don't. No solid right or wrong in preferences. If that's what someone prefers. Again though, absent any real facts or evidence to support distrust of something. I'll take my chances where reasonable "to me" on a gnu/Linux OS.

Last edited by BLizgreat! (2017-11-13 21:58:10)

Offline

#7 2017-11-13 22:00:39

p9000
Member
Registered: 2017-05-28
Posts: 22

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

Pip itself is probably OK. But the packages it installs are less vetted than typical Linux distribution packages.

It's also not clear to me what happens when a local python package (installed via apt) conflicts with something pip pulls. Does it put everything in /usr/local or something like that?

Offline

#8 2017-11-13 22:05:48

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

^ Hey thanks, actually will do a bit of checking before over using the thing. With Hoas and yourself saying such stuff. Really won't be resorting to using it often and will double check the quality/integrity of modules a bit beforehand.

I'm not at all sure where it installs and which paths commonly. Would assume it's generally standardized in how someone develops a python module but am taking a blind guess in that. Ps_mem did as you mention, would have to google to really know more about it.

Last edited by BLizgreat! (2017-11-13 22:07:43)

Offline

#9 2017-11-13 22:25:12

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

See this.

Found the below interesting, went ahead and installed it too for better dependency resolution. Didn't use sudo in installing and it went off without a hitch. Perhaps not wholly necessary but it sounded like something I wanted and I can spare the disk-space, so did it.

Installing Pipenv

Pipenv is a dependency manager for Python projects. If you’re familiar with Node.js’ npm or Ruby’s bundler, it is similar in spirit to those tools. While pip can install Python packages, Pipenv is recommended as it’s a higher-level tool that simplifies dependency management for common use cases.

Use pip to install Pipenv:

pip install --user pipenv

Also that too. Have nothing against python from what I know about it ... is a fairly good coding language. Really just wanted a fast/easy way to get the latest ps_mem and went with one of the maintainer's recommended methods. Hoas provides an alternative if for any reason someone were to elect not using python-pip/etc.

Last edited by BLizgreat! (2017-11-13 22:34:30)

Offline

#10 2017-11-13 22:48:48

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

Note: Apparently as per the links above it's possible to install for a given user, using pip, rather than system-wide. For something like ps_mem isn't going to matter which someone goes with. Though like Hoas's method better, as it would already take care of any need for sudo and without password required too. Oh well ... that's why I call him the HOASINATOR ! big_smile

Plus hey, think pip is kind of cool/interesting and will dork with it some more. Though won't get carried away with it either.

Offline

#11 2017-11-14 01:50:40

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

If at all possible, install stuff from the Debian repositories. pypy has been reported to have some malware show up on it. The way it is done is by picking a name similar to an actual package, so it's not a guarantee that one would be installed, assuming we know the name of the package that is going to be installed.

However, we can be guaranteed that packages coming out of Debian's repositories are legit. So far, the only python package I have had to pip install was the coinbase api and that is simply due to the newness of it.

Check out python-psutils for a more comprehensive package that allows for cpu usage, memory, etc. I am slowly working on a series of small pygtk widgets using said package.

Last edited by tknomanzr (2017-11-14 01:51:28)

Offline

#12 2017-11-14 02:35:00

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

^ Thanks A LOT:), will check it out for sure and for the heads up for myself and others. Don't see over using pip anyway.

Offline

#13 2017-11-14 06:18:33

p9000
Member
Registered: 2017-05-28
Posts: 22

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

I use it for scientific software which is usually either out of date in distro packages or not packaged at all.

Nice that it can install as non root. Still need to check that you're not downloading malware though.

Offline

#14 2017-11-14 09:04:44

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: Install latest version of ps_mem on Bunsenlabs and Debian gnu/Linux.

^ Thanks and think kind of underscores pip's value. Am going to guess there are vetting and over-sight in place. Any project that would want to be taken seriously couldn't afford just fast and loose or it'd lose a lot of credibility and support. However can't swear to that in terms of how python modules are maintained on that resource. Still think pip is cool-interesting. Still not planning on over using it. Can at least see how it's useful and how application of some common sense is ALWAYS prudent in computing.

Just imo ... not to a point where it get's out of hand, oh woe, BEWARE, do NOT dare this, nor that ! Lest certain DOOM befall you. Just don't think it's that serious, at least that's my take on it. Plus I still like Hoas's approach to this how to better for various reasons. Less to do with security/stability and more to do with it being more eloquent and efficient. Though as noted if used --user rather than system-wide, looks like much the same is easily done with pip and someone who knows it's use, Aka: NOT ME. big_smile

Last edited by BLizgreat! (2017-11-14 09:06:22)

Offline

Board footer

Powered by FluxBB