BrainScraps Wiki
Advertisement

Here, simply, is a collection of information for doing various things on a unix system. Quite simply, my quick reference list.

regex

  • Lookarounds (regex exceptions): On linux box, grep messages log for occurrences of sudo access from userA and userB, but exclude korn and posix shells and the additional "no passwd entry for -i" message that goes with those logs.
/bin/grep -P '^.*sudo:( )+(userA|userB) :.*(?<!USER=userC ; COMMAND=/usr/bin/[k]sh|no passwd entry for -i!)$' /var/log/messages

mount on loop device

Loop devices are handy for mounting ISOs and RAM disks.

$ mkdir /home/user/DVD_mountpoint
$ sudo mount /home/user/path/to/DVD.iso /home/user/DVD_mountpoint -t iso9660 -o loop
Advertisement