Files

Compare files

Source

Compare two sorted files line by line:

$ comm <file>

Double files

Use fdupes in order to find duplicate files in a directory:

$ fdupes --noprompt -d [--recurse] .

ripgrep

Use rg for searching recursively through files and faster than with grep or egrep.

Ripgrep on Github

Truecrypt

Error

Source

  • Description: When trying to mount a truecrypt file/device the following error appears:
Failed to set up a loop device: /path/to/truecrypt/archive
  • Cause: In Linux, a loop device permits a file that simulates a physical storage device (e.g., an archive file like a CD-ROM image, or TrueCrypt volume) to be accessed like a real storage device (e.g., a hard disk or USB stick). That way you can browse the archive and perform file operations on it just like you would your /root and /home volumes. But each loop device has to be mounted on your filesystem like any other storage device, usually as /dev/loop0, /dev/loop1, and so forth.

    Version 3 of the Linux kernel added a new loop-control device (link is external) that allows for dynamically creating and destroying loop devices as needed in /dev/. The loop-control device lives at /dev/loop-control.

    But since loop-control is a relatively new feature, any application that hasn't been updated (link is external) to call the loop-control hook won't be able to create a new loop device if needed. And since TrueCrypt hasn't seen a major new release in almost two years -- and its last release wasn't too long after kernel 3 -- it's unaware of /dev/loop-control.

  • Solution: So for now you can manually create a loop device for TrueCrypt to use:

    $ mknod -m 0660 /dev/loop0 b 7 0
    

mlabel

Source

Relabel a partition without formatting.

$ mlabel -i <device> ::<label>

dwdiff

Source

Instead of line based changes, the tool dwdiff provides (colored) output for changes and diffs between files.

$ dwdiff -c file1 file2