21 03 | 2017

Bad support of ZIP archives with extra fields

Written by Tanguy

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

For sharing multiple files, it is often convenient to pack them into an archive, and the most widely supported format to do so is probably ZIP. Under *nix, you can archive a directory with Info-ZIP:

% zip -r something.zip something/

(When you have several files, it is recommended to archive them in a directory, to avoid cluttering the directory where people will extract them.)

Read more Bad support of ZIP archives with extra fields

24 09 | 2013

Working with XML using standard Unix tools

Written by Tanguy

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

Like it or not, XML has been used everywhere, even in cases where text-based formats would have been sufficient. Unfortunately, standard tools such as grep, sed or awk are not really adapted to work with XML. Let us take the following example:

<chapter
    xmlns="http://docbook.org/ns/docbook" version="5.0">
    <title>The Debian distribution</title>

    <para>Debian is a free operating system, describing itself as “the
    universal operating system”. It is mostly known as a GNU/Linux
    distribution, but it also exist in other variants such as GNU/Hurd
    and GNU/kFreeBSD…</para>
</chapter>

Read more Working with XML using standard Unix tools

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.

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

20 05 | 2011

cpio > tar

Written by Tanguy

Classified in : Homepage, Debian, Miscellaneous

Large package icon

tar and cpio

tar(5) and cpio(5) are two competing archive formats, that provide almost identical features. Both are streamed formats, originally designed to be used on tapes. Their major practical difference is the style of their standard command line utilities:

  • cpio(1) takes the list of files to archive on its standard input, allowing a very high control but requiring to use another utility such as find(1) to archive an entire tree;
  • tar(1) usually takes the list of file to archive on its command line, and browses directories recursively be default.

Read more cpio > tar

page 1 of 2 next

Archives