Sometimes it’s very useful to know which git branch you are working on right from the command prompt. There are many solutions out there, but most of them include python and some awk or grep magic which can time a serious amount of time when you cd into a reasonably large git tree. But you can also take advantage of… Read more »
When an upgrade includes changes to a default configuration file, the package will write either a .rpmnew or a .rpmsave file instead of overwriting the configuration file on your system. Which file a package creates is up to the discretion of the package maintainer. From “Dealing with .rpmnew and .rpmsave files” By Bruce Byfield: An .rpmnew file contains the new… Read more »
Sometimes, extracting a whole tar archive can be a waste of time (and temporarily disk space). To extract just a single file, you can use This extracts the file file to /tmp/ Of course, most of the time the relative path to the file is not as simple as in the example above: This creates the file /tmp/path/to/file. To avoid… Read more »
Well, there is no native command (at least, afaik), but you can use find to easily identify empty folders (which maybe helpful for maintenance, etc.): Find empty folder and list Find empty folder and save as temporary file Find empty folder and delete See also find manpage
Unfortunately, there is no way to pipe data directly to scp simply because scp can’t read from stdin. But you can abuse ssh to achieve the same result You can even do some funny things like
If you want to use GnuPG in a script and don’t want to be prompted for the passphrase, put the passphrase in a file called passphrase.txt and use this to encrypt: Of course, you can also use echo to specify your passphrase or you can pipe a tarball into gpg or even send a gpg encrypted tarball via e-mail Note… Read more »
The Lempel-Ziv-Markov chain algorithm is a (at least in the Linux-world) relatively new compression method. It features a very high compression ratio that is generally much higher than bzip21. Unfortunately there a quite a few different implementations. So creating and extracting lzma archives on different Linux distrubutions will vary. While the latest Fedora comes with GNU tar 1.22, which has… Read more »
Just as you can convert entire files from one charset to another, you can convert the filenames. For example: would recursively convert all files in the current directory from iso-8859-1 charset into utf-8. Well, not exactly. To finally rename the files you need the –notest flag. Otherwise convmv will perform a dry run without any changes.
How to convert iso-8859-1 charset files into utf-8? Simple: Of course, your values for –from-code and –to-code may vary. For a list of available encodings use iconv –list
Just because I always forget: Step 1: Create public and private keys using ssh-keygen Step 2: Copy the public key to remote-host using ssh-copy-id Now here comes the awesome part: You don’t have to scp the public key to your remote host and cat it into ~/.ssh/authorized_keys. Instead, you can use ssh-copy-id