Bad support of ZIP archives with extra fields
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.)
Working with XML using standard Unix tools
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>
“Everything is a file” rocks
Classified in : Homepage, Debian, Command line, Miscellaneous
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.
OpenSSH tip: connection sharing
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:
- 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.
- 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.
cpio > tar
Classified in : Homepage, Debian, Miscellaneous
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 asfind(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.
page 1 of 2 next