16 04 | 2012

“Everything is a file” rocks

Written by Tanguy

Classified in : Homepage, Debian, Command line, Miscellaneous

Licence plate with “UNIX” written, subtitle “live free or die”

Unix rocks, or at least one of its design feature does: everything is a file.

Here is one funny use of that feature. I consider that programs that manipulate text should basically take it on their standard input, and write it to their standard output, while specifying the name of an input or output file should be an optional refinement.

Well, at least one program was designed the other way: when used to import a foreign key, ssh-keygen -i has no option to read it on its standard input. No problem, this can be worked around:

# ssh-keygen -if /dev/stdin
[paste the foreign key here]

Unfortunately, that does not work with every action of ssh-keygen since not all of them were written to be able to handle streams, which cannot be rewound.

20 02 | 2012

Opportunistic SSH agent

Written by Tanguy

Classified in : Homepage, Debian, Command line, Lazyweb

To use an SSH agent, one usually has to:

  1. launch the agent;
  2. add his key to it.

The first step can be automated in the desktop or shell startup script (this is a typical use case for login shell-only startup scripts, by the way), but the second one cannot if your private key is protected by a passphrase.

Read more Opportunistic SSH agent

16 02 | 2012

OpenSSH tip: connection sharing

Written by Tanguy

Classified in : Homepage, Debian, Command line, To remember

The last versions of OpenSSH brought an interesting feature: sharing multiple sessions over a single connection. When enabled, this is how it works:

  1. The first time you open an SSH connection to a server (including anything that works on top of SSH, like SCP, SFTP, rsync or Git), it opens a network connection as usual. It also opens a local Unix socket and listens to it for later use.
  2. The next times you open an SSH connection to that server while the first one is still open, instead of opening a new network connection, it connects to that local Unix socket and lets the first SSH client carry its new session.

Read more OpenSSH tip: connection sharing

08 12 | 2011

Return codes

Written by Tanguy

Classified in : Homepage, Debian, Command line, Grumble

According to Eric S. Raymond, one rule for Unix programming is the Rule of Silence: When a program has nothing surprising to say, it should say nothing. Since return codes are a form of information, I would like to add: when a program has carried out its task with no surprise, it should exit(0).

Read more Return codes

03 10 | 2011

Viewers should stay in foreground

Written by Tanguy

Classified in : Homepage, Debian, Command line, Grumble

Traditionally, when you start a program to view a document, for instance xpdf resume.pdf, it stays in foreground, and only returns when it finishes, when you are done with the document. Of course you can still run it in background if you want.

Nowadays, several programs behave in a different way, for instance Evince. When you first start it, it stays in foreground as usual. However, if you launch it a second time while the first instance it still running, it will reuse this existing instance, asking it to open your document in a new window, and immediately return. Other examples are Firefox and LibreOffice.

Read more Viewers should stay in foreground

Rss feed of the category

«previous page 6 of 8 next »

Archives