Home
Losers Wiki
Cancel

set-sticky-bit

chmod +t test/ shows as t in last bit ls -ld test drwxrwxr-t 2 user user 4096 Oct 21 14:11 test This next bit isn’t actually the sticky bit, but rather is setuid or gid. Use this to force all f...

sending-file-attachments-from-command-line

use mutt; echo "This is the body of the email" | mutt -a the_attachment.file -s "the subject of the email" the.recipient@a.mailaddress

send-email-when-user-ssh-s-in

Ubuntu in /etc/sshd/sshrc; ip=`echo $SSH_CONNECTION | cut -d " " -f 1` logger -t ssh-wrapper $USER login from $ip echo "User $USER just logged in from $ip" | mail -q -s "SSH Login" "Admin<adm...

sed

sed--remove-comments-and-blank-lines

multiple -e command scan be combined on a single line sed -e 's/#.*$//' -e '/^\s*$/d' /etc/webalizer.conf -e 's/#.*$//' <- this looks for the # character followed by any single character (.) a...

sed--find-and-replace-in-file

sed -e "s/`/``/g" file`

sed--append-text-to-a-line-with-a-pattern

The following will append ‘,doubletake_servers’ to the end of a line containing ‘hostgroups’ sed '/hostgroups/ s/$/ ,doubletake_servers/' filename.cfg

script-options

use getopts, for example; #!/bin/bash if [ $# -lt 6 ] # we expect 6 options, 1 for each switch and 1 for each value then echo "Usage: $0 -v vhost -u user -c cluster" >&2 ex...

sausage-and-broccoli-carbonara

ingredients 1 tbsp olive oil 8 chipolatas, meat squeezed out and rolled into balls 3 eggs 50g parmesan, grated, plus extra to serve (optional) 300g spaghetti 1 head broccoli, broken i...

samba

UFW rules allowing Samba To Action From -- ------ ---- 137/udp ALLOW 192.168.10.0/24 138/udp ...