2011w44

FSCONS

T minus 5 days and counting :D

It’s gonna be great to see all the familiar faces again and hopefully get to know some new people as well.

(h)top

top (and it’s more colorful sibling htop) can be a great tool for keeping track of processes, and to some extent users, in a system. If, for instance, you’re sharing a system with a couple other people, and the systems starts feeling sluggish, top will help you out by displaying the process id (and the username which started the process) of the process consuming the most CPU cycles.

If you’d rather sort on the processes consuming the most system memory that would be On<ESC> (i.e. “<shift>o” followed by “n” followed by <ESC>)
Note that this is done from inside a running top.

You could even single out a specific user for monitoring with

$ top -u <username>

bc

This one took me a while to figure out… I had this problem during the week, which I for the life of me cannot remember now, but it manifested itself in that my attempts to do

$ echo "$part / $total" | bc

didn’t do the trick as it just truncated the value down to 0.

And the solution to this, which I found at Linux By Examples was rather simply to add a scale command to bc:

$ echo "scale=3; $part / $total" | bc

Perl

Named capture groups are great (I already knew of them from Python (Django, urls.py) but they took me quite some time to hunt down in Perl.

Links

The Geek Stuff has some really great posts about various more or less admin-oriented commands (indeed, when I was in a hurry to learn what I needed from top this week, The Geek Stuff was my primary tutor.

Tags: , , ,

Comments are closed.