Command cheatsheet

su to user with no login shell

To become a user that has /bin/false as shell:

# su - user -s /bin/<some shell>

find duplicate lines in a file

$ sort FILE | uniq -D

(Must sort since uniq will only look at consecutive lines)

Can also limit the number of characters to compare, e.g. 20 characters:

$ sort FILE | uniq -D -w 20

source: http://www.linuxquestions.org/questions/linux-software-2/finding-duplicate-lines-in-a-file-617441/

find duplicate files

The method above can be used with a list of hashes to locate identical files:

$ md5sum * > MD5SUMS
$ sort MD5SUMS | uniq -D -w 32

CD/DVD imaging

ISO extraction

Source: Dd - Destroyer of disks

(A simple dd will work but might carry some extra garbage)

Discover sector size (2048 for standard ISOs) and ISO size:

$ isoinfo -d -i /dev/cdrom
... # e.g.:
Logical Block Size: 2048    # <- sector size
...
Volume Space Size: 123456    # ISO size
$ dd if=/dev/cdrom bs=2048 count=123456 conv=noerror of=image.iso

conv=notrunc Appends to output conv=noerror Continues after read errors
(can be combined with conv=notrunc,noerror)

Dump VideoCD

$ vcdxrip -C     # Part of vcdimager
linux/cheatsheet.txt · Last modified: 2012/07/28 14:08 by Toni Corvera
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki