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
 
 linux/cheatsheet.txt · Last modified: 2011/08/09 19:10 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 Driven by DokuWiki