View the Most Wanted LQ Wiki articles.
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Uncategorized Entries with no category

Note to myself, for whenever I get an SSD...

Posted 08-06-2014 at 10:36 PM by the dsc (linux-related notes)
Tags ssd, swap

If it would still apply for future technology...

Current good quality SSDs have built-in mechanisms to level the wear on the whole device so that their lives are maximised, but for something like Swap the inherent nature of that requirement will significantly ratchet up the number of Write cycles on any drive that hosts it, and that is still something I want to avoid on my SSD.

In reality it may not be a factor, but I'd rather spend a few dollars on more RAM to reduce
Posted in Uncategorized
Views 465 Comments 0 the dsc is offline

Listing the average file size for all subfolders (+listing subfolders without ls or find)

Posted 08-03-2014 at 08:11 PM by the dsc (linux-related notes)
Updated 08-03-2014 at 09:04 PM by the dsc

A tiny "Frankenstein monster" one liner, adding a little bit from several sources/blogs/blog comments:

lsf | while read d ; do find ./"$d" -iname "*.*" -type f -printf "%k\n" | gawk '{sum += $1; n++;} END {print sum/n;}' |sed "s|$| -- $d|" ; done | sort -n

Where the first "command", "lsf" is actually a custom function:

lsf ()
for f in * ; do [ -d "$f" ] &&
Posted in Uncategorized
Views 345 Comments 0 the dsc is offline

Bash quickie] Get a "random" number (larger than zero, within a range) with "shuf" only

Posted 07-31-2014 at 01:16 AM by the dsc (linux-related notes)
Updated 07-31-2014 at 01:39 AM by the dsc (deweirdifying the wording)

It always annoys me when I see things like "cat file | grep pattern | sed ..." when just "sed" would suffice, but I was guilty of using seq only to shuf random numbers when shuf can do it by itself.

shuf -n 1 -i 0-999999999

(apparently the largest number you can get is $((9999**8)) (9999^8 in bash-math), larger than that it gets negative, for some reason )

You also don't need to do some fancy "echo -e" with several...
Posted in Uncategorized
Views 303 Comments 0 the dsc is offline

KDE's "ark" as a command-line universal (un)archiver

Posted 07-28-2014 at 02:44 PM by the dsc (linux-related notes)
Tags ark, zip

For some reason I was having issues with some zip files. "Unzip" wouldn't unzip them, but ark (and perhaps other GUI archivers) would.

Fortunately ark can be used as a command line tool as well, which can be better than needlessly opening the full GUI just to make something so trivial. You still can invoke just the dialog, anyway.

But in order to extract something, for example, one can just use:

ark -b -o ./extantfolder

Posted in Uncategorized
Views 368 Comments 0 the dsc is offline

A clock as the header of Openbox' root menu

Posted 07-15-2014 at 04:15 PM by the dsc (linux-related notes)
Updated 07-16-2014 at 06:35 PM by the dsc (grammar?)

If you want a clock instead of the typical "openbox"-labeled separator at the top of the root menu. The way to do that isn't the most nice and convenient way imaginable, though. Essentially you have the root menu as a pipe menu.

The executed script is just a sed one liner:

 sed "s|INSERT-CLOCK-HERE|$(date +'%-H:%M')|" $HOME/.config/openbox/menu-sed.xml
This a "24 hour" clock format, without leading zeros,...
Posted in Uncategorized
Views 503 Comments 0 the dsc is offline


All times are GMT -5. The time now is 08:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration