Tuesday·22·March·2011
Different Flavours of Planet Commandline //at 22:40 //by abe
Since there were quite some requests for a Planet Commandline feed without the microblogging feeds included, I splitted Planet Commandline into different flavours. I’m quite happy with that solution, because I must admit that the amount of microblogging postings in relation to normal blog postings was indeed higher than initially expected
So from now on Planet Commandline has a basic flavour at http://planet-commandline.org/ and one with the microblogging feeds (climagic and commandlinefu) included at http://planet-commandline.org/+snippets/.
For making this possible I hacked our Planet Venus wrapper to accept arbitary configuration snippets to be added at the end of the configuration as well as as sed-based modifications to the concatenated configuration before Planet Venus is run on them.
This also allowed me to create further flavours of Planet Commandline:
- +german where Beat Gätzi’s German-written Chrütertee blog has been moved to, and
- +emacs which adds Mickey Petersen’s Mastering Emacs to the list of included blogs.
I hope nobody minds this diversification of Planet Commandline.
Currently no combination of flavours is supported, but if there’s a
relevant demand for the one or the other combination of flavours I may
have a look if that can be automated, too.
Tagged as: Hack, Microblogging, Other Blogs, Planet Commandline, Planet Venus
// show without comments // write a comment
Planet Commandline officially online //at 22:25 //by abe
Around the first bunch of postings in my Useful but Unknown Unix Tools, Tobias Klauser of inotail and Symlink fame came up with the idea of making a Planet (i.e. a blog aggregator) of all the comandline blogs and blog categories out there.
A first Planet Venus running prototype based on the template and style sheets of Planet Symlink was quickly up and running.
I just couldn’t decide if I should use an amber or phosphor green style for this new planet. Marius Rieder finally had the right idea to solve this dilemma: Offer both, an amber and a phosphor green style. Christian Herzog pointed me to the right piece of code at A List Apart. So here is it, available in you favourite screen colors:
For a beginning, the following feeds are included:
- Myon’s Unix blog category
- Evgeni Golov’s Desktop in a Shell column
- My Useful but Unknown Unix Tools column
- My Shell blog category
- The GRML Development Blog
- Chrütertee (Swiss-German)
- Commandline Magic’s identi.ca feed
Which leads us to the discussion what kind of feeds should be included in Planet Commandline.
Of course, all blogs or blog categories which (nearly) solely post neat tips and tricks about the command line in English are welcome.
Microblogging feeds containing (only) small but useful command line tips are welcome, too, if they neither permanently contain dozens of posts per day nor have a low signal-to-noise ratio. Unfortunately most identi.ca groups do, so they’re not suitable for such a planet.
What I’m though unsure about are non-English feeds. Yes, there’s one in already, but I noticed this only after including Beat’s Chrütertee and his FreeBSD command line tips are really good. So if it doesn’t go overboard, I think it’s ok. If there are too many non-English feeds, I’ll probably split Planet Commandline off into at least three Planets: One with all feeds, one with English only and one with all non-English feeds or maybe even one feed per language. But for now that’s still a long way off.
Another thing I’m unsure about are more propgram specific blogs like
the impressive Mastering Emacs blog “about mastering the world’s best text
editor”. *g*
(Yeah, I didn’t include
that one yet. But as soon someone shows me the vi-equivalent of that
blog, I’ll include both. Anyone thinks, spf13’s vim
category is up to that?)
Oh, and sure, any shell-specific (zsh, tcsh, bash, mksh, busybox) tips & tricks blogs don’t count as program-specific blogs like some $EDITOR, $BROWSER, or $VCS specific blogs do. :-)
Of course I’m happy about further suggestions for feeds to
include in Planet Commandline. Just remember that the feed should
provide (at least nearly) exclusively command line tips, tricks or
howtos. Suggestions for links to other commandline related planets are
welcome, too.
Tagged as: Chrütertee, CLI, CoolTools, FreeBSD, grml, inotail, LUGS, Myon, nuggets, Other Blogs, Planet Symlink, Planet Venus, Shell, tuxedo, UUUCO, UUUT, Zhenech
// show without comments // write a comment
Related stories
Wednesday·24·November·2010
Perfect Team: autossh and GNU Screen //at 01:06 //by abe
SSH is definitely one of my most often used tools, not only for system administration at work but also on the road with my netbook, an EeePC 701 running Debian Sid.
On the road, it often happens that I have a flaky WLAN or UMTS
connection, so I often have to kill (via <Enter>~.
)
and reconnect my SSH session due to a changed IP address or so.
First step against problems arising from using SSH over unreliable network connections is of course GNU Screen. Second step is use SSH keys and ssh-agent to not needing to type the password on every reconnect.
But it’s still very annoying to kill the SSH connection and call ssh again manually. For luck there is autossh, a wrapper around SSH which regularily checks via two tunnels connect to each other on the remote side if the connection is still alive, and if not, it kills the ssh and starts a new one with the same parameters (i.e. tunnels, port forwardings, commands to call, etc.).
It’s quite obvious that this is perfect to be combined with screen’s
-R
and -d
options (Reattach if a detached
screen is around, else start a new screen; detach a currently attached
screen), so I found myself very often typing (or fetching it from the
commandline history :-):
autossh -t sym.noone.org 'screen -Rd'
-t
is necessary to allocate a terminal device on the
remote machine which is not done by default if you directly call a
command via ssh
.
In comparision to OpenSSH, autossh needs the single quotes, because
otherwise it would parse -Rd
as options to parse to
ssh
and bail out. That’s not a real problem, but when
you’re used to just type ssh -t sym.noone.org screen -Rd
without any quotes, you’ll run into this then and when.
Update, 25-May-2010, 14:55: As Carsten Hey points
out, autossh
also supports the --
option to
declare that all following options and parameters must be passed to
ssh
itself. (End of Update)
Typing that often and mistyping it then and when cries for an shell alias or an shell function. So I came up with the following shell function:
asc() { autossh -x -a -t "$@" 'screen -RdU' }
I used a function instead of an alias in case of autossh
will in future regard all parameters given after the command as part
of the command as ssh
does.
The additional options -x
and -a
disable X
and SSH Agent forwarding which both don’t work if you reattach to an
already running screen
.
And if you’re using Zsh as I do, you can even add some more format string magic to set the window title more or less to the expanded alias, eh, function:
function asc() { # Set the title to something more obvious, e.g. the expanded # alias, eh, function print -Pn "\e]0;%n@%m: autossh -t $* 'screen -RdU'\a"; autossh -x -a -t "$@" 'screen -RdU' } compdef asc=ssh
Update, 25-May-2010, 14:59: As Hauke points out in a
comment, Zsh users should also declare that asc
should
have the same tab completion as ssh
itself. The example
above has been updated accordingly. (End of Update)
In the meantime on the EeePC I use asc
on the
commandline more often than ssh
itself. And I nearly no
more type autossh
. (The most common exception here is
autossh hostname tail -F /path/to/some/logfile
.)
Using that function you can also add common ssh
options
for tunneling, etc. — I use it most often like this:
asc -D 1080 sym.noone.org
This opens a SOCKS proxy on localhost, port 1080 and that way I can surf via the host I’m connecting to by SSH.
There’s one small drawback though: You didn’t expect that I can just
invent some new three letter command without a namespace clash, did
you? There is a free game called Advanced Strategic Command whose binary (and Debian package)
is named asc
, too. If you have that game installed, you
can always call it using its full path, e.g.
/usr/games/asc
on Debian.
P.S.: My whole grml based .zshrc is also
available via git at
git.noone.org as well as on github.
Tagged as: alias, asc, autossh, CLI, Debian, EeePC, function, GNU, grml, nuggets, OpenSSH, Proxy, roadwarrior, screen, shell, Sid, SOCKS, SSH, tip, tunneling, zsh, zshrc
// show without comments // write a comment
Related stories
Multiple Move & Co. //at 00:08 //by abe
nion’s
blog made me notice that many people don’t know mmv
(multiple move), which approximately
works like this:
mmv '*.htm' #1.html mmv '*.foo.*' #1.#2.bla
Additionally, mmv
also can copy, link or
even append files when called as mcp
,
mln
or mad
respectively with the appropriate command line options.
When I told nion in IRC on #debian.de about mmv
, HE pointed me to the Perl
script /usr/bin/rename
, which is in Debian’s perl
package and therefore installed on nearly every Debian system by
default. It moves files by applying perl subsitutions to file names:
rename 's/\.htm$/.html/' *.htm rename 'y/A-Z/a-z/' *
Being curious, if the newly found tool is not only available in
Debian, I looked on a SuSE 9.0 box and indeed, I also found there a
/usr/bin/rename
. But — surprise,
surprise — it’s not a Perl script but an ELF binary. And although it
does similar things than mmv
and Debian’s
rename
, it is the simplest of the three
commands:
rename .htm .html *.htm rename foo foo00 foo? rename foo foo0 foo??
Note to my self: Nice add-on for your command line efficiency
talk.
Tagged as: Debian, Linux, nuggets, Open Source, Other Blogs, Shell, SuSE, UUUT
// show without comments // write a comment
Related stories
autossh vs TCP resetter //at 00:08 //by abe
LUG-Camp 2007 in Interlaken is nearly over, and I’m reading my mail as usual using ssh, screen and mutt on the server. But the ssh connection resets every few minutes. According to the LUSC people (who are running the gateway) some script kiddie is running a TCP resetter somewhere in the network.
I remembered that I read about autossh in the Debian package list once a while and that it sounded cool but I had no use for it yet. Until now.
I’m writing this over the same crashing ssh connection and I’m typing without taking big notice of the quite often occurring connection resets:
autossh noone.org -t 'screen -rd'
It just works. :-)
Tagged as: autossh, Events, Interlaken, LUG-Camp, LUSC, mutt, nuggets, screen, SSH, tunneling
// show without comments // write a comment
Related stories
Thursday·14·October·2010
xen-tools 4.2 released //at 13:55 //by abe
Last night, I released xen-tools 4.2 and also uploaded it to Debian Unstable. It also should become part of the upcoming Debian stable release called Squeeze. (Thanks, Mehdi!)
For those who are missing xen-tools in Ubuntu 10.04 Lucid Lynx or Ubuntu 10.10 Maverick Meerkat, there’s now a xen-tools PPA containing the current stable package for both Ubuntu releases.
Major changes since the 4.2 release candidate 1:
- Tons of documentation improvements
- Preliminary support for Ubuntu 11.04 Natty Narwhal and Debian 7.0 Wheezy (Closes #597521)
- More robustness on exotic combinations of command-line options
Major changes since 4.2 beta 1:
- Uses GeoIP for Debian mirrors: Default Debian mirror is now cdn.debian.net
- Uses
apt-config
to parse Dom0’sapt.conf
. (Closes #560011) - With
--verbose
, the output of commands called by xen-tools (e.g. debootstrap) is not only logged, but also printed toSTDOUT
. (Closes #513126) - Adds btrfs support.
New Team Member
I’d also like to welcome Stéphane Jourdois as member of the xen-tools development team who contributed quite a lot of the new code in 4.2. See GitHub’s Impact Graph or Ohloh’s List of Contributors.
Roadmap
If there’s no need for a bug fix release, the next release will be 5.0 and will be the result of some heavy refactoring. Our aim is:
- less code duplication
- more modularity
- more consistency over all included scripts and hooks
We will probably also use Perl::Critic to improve the code consistency and
quality further. (Thanks Renée for the idea!)
Tagged as: 42, btrfs, code duplication, debbugs, Debian, GeoIP, GitHub, Gitorious, hook, kwisatz, Lucid, Maverick, Natty, Ohloh, Perl, Perl::Critic, post-receive, PPA, Refactoring, Release, Sid, Squeeze, Ubuntu, Wheezy, Xen, xen-tools
// show without comments // write a comment
Related stories
Sunday·26·April·2009
Screen and Emacsclient: Automatically switching to the Emacs window //at 10:38 //by abe
For a very long time, I use mutt with emacsclient as configured editor
and a single GNU Emacs instance started from either .screenrc
or .Xsession
, depending on the system. And I’m very used to
switching the virtual desktop or the screen window after starting a
mail in mutt.
Since Debian 5.0 Lenny and Emacs 22, Emacs automatically grabs the
focus and switches to the right virtual desktop. So after telling mutt
recipient and subject of a new e-mail, it invokes emacsclient and
immediately the focus has moved to the running Emacs instance. Because
I was used to switch one virtual desktop to the right at that point, I
often found my self two desktops to the right until I got used to it.
:-)
I usually hate applications which grab the focus without being asked. But in this case I basically asked for it. And there’s no delay like with starting up an application which has to read in some database first – think of Liferea or Rhythmbox which take many seconds to minutes to start up, even on my 2.2 GHz dual core ThinkPad.
In the meantime I got so used to that automatic desktop switch that I forget to switch the screen window in the second scenario where I use this combination: My screen doesn’t automatically switch to the Emacs window (window 1) after I told mutt recepient and subject in window 2.
Knowing that screen is quite scriptable, I found out that only a very
small change is needed to my mutt configuration to get that desktop
feature to my everyday screen session. I simply replaced the editor
setting in my .muttrc
with the following
line:
set editor="screen -X select 1;emacsclient"
Now mutt tells screen to switch to window 1 (where Emacs is running) and then tells Emacs to open the appropriate file to edit my new mail.
Update Friday, 2009-04-24, 18:22
Even though Zack surely is right with his comment about the multi-terminal feature of the upcoming GNU Emacs 23, I still have Etch (and therefore GNU Emacs 21) on the server where I have my screen session.
So the next step was to switch back to the mutt window (window 2)
after I’m finished with editing the mail. Since mutt gives the the
file to edit as argument to the contents of $editor
,
simply adding ;screen -X select 2
at the end of
$editor
doesn’t suffice.
So I wrote a small shell script (named ~/.mutt/editor.sh
) as wrapper which calls all the
commands and passes the parameters to the right command:
#!/bin/sh screen -X select 1 emacsclient -a ~/.mutt/alteditor.sh "$@" screen -X select 2
Of course, $editor
is now set to that script:
set editor="/home/abe/.mutt/editor.sh"
Emacsclient of GNU Emacs 21 already supports the -a
option to call
another editor in case of not being able to connect to a running Emacs
instance. Since I don’t want to switch to another screen window in
that case, I wrote a second shell script (named ~/.mutt/alteditor.sh
) which switches back to the mutt window
and then calls GNU Zile, my preferred low-end emacs clone:
#!/bin/sh screen -X select 2 zile "$@" screen -X select 1
I love it!
Tagged as: $EDITOR, Debian, E-Mail, Emacs, Emacs21, Emacs22, Emacs23, emacsclient, Etch, GNU Screen, Lenny, mutt, screen, scripting, zile
// show without comments // write a comment