LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

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

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

Posted Yesterday at 01:16 AM by the dsc (linux-related notes)
Updated Yesterday 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...
Member
Posted in Uncategorized
Views 32 Comments 0 the dsc is offline
Old

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 file.zip -o ./extantfolder

...
Member
Posted in Uncategorized
Views 37 Comments 0 the dsc is offline
Old

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:

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

Bash/command line - minor variable "editing" without sed

Posted 07-14-2014 at 12:38 AM by the dsc (linux-related notes)
Updated 07-14-2014 at 03:02 PM by the dsc

Code:
$ a=lilolal ; echo ${a/lal/uuu}
lilouuu
To move files "copied" on clipboard (Konqueror/perhaps dolphin) to the place you're on a terminal, without navigating/browsing the folders on the file manager, one can use:

xsel -b | while read f ; do mv -i "${f#*file://}" ./ ; done

As "copied" files on Konqueror are registered on the clipboard as a list with "file://" preceding the path. Perhaps could be aliased...
Member
Posted in Uncategorized
Views 111 Comments 0 the dsc is offline
Old

Interesting "ask ubuntu" message related to swappiness tweaks

Posted 07-09-2014 at 09:06 PM by the dsc (linux-related notes)

http://askubuntu.com/questions/18421.../184221#184221

Quote:

Why most people recommend to reduce swappiness to 10-20?
Because most believe that swapping = bad and that if you don't reduce swappiness, the system will swap when it really doesn't need to. Neither of those are really true. People associate swapping with times where their system is getting bogged down - however, it's mostly swapping because the system
...
Member
Posted in Uncategorized
Views 118 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement

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