= My list of commands I always forget

== To add a user:
   sudo useradd -d /home/testuser -m testuser

== To create a group
   addgroup <group>

== To change the primary group of a user:
   sudo usermod -g <group> <user>

== To add a user to a group as a secondary group:
   usermod -a -G Group-name Username

== Delete a user from a group
   deluser <username> <groupname>

== Set a password for the new user
   sudo passwd <user>

== Inspect a user:
   id

== Make only directories executable:
   chmod a+X -R *

== Make a symlink:
   ln -s {/path/to/file-name} {link-name}

== To install an init script on Ubuntu
   update-rc.d p4_1_init defaults 

== Figure out the version of Ubuntu you're running:
   lsb_release -a

== Running Perforce commands with the SDP 
   /p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 <command>

== Find a file based on permissions
   find . -perm /u=x,g=x,o=x

== All things UFW (firewall management)
   https://help.ubuntu.com/community/UFW

== Create a new template for a site in Apache
   sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site1

==Enable and disable sites in Apache
   sudo a2dissite default && sudo a2ensite site1

== Reverse SSH to give a DMZ machine Perforce access
    ssh -R forums.example.com:1999:perforce.example.com:1666 forums.example.com

== Take a checkpoint using SDP
   /p4/common/bin/p4master_run 1 /p4/common/bin/live_checkpoint.sh

== Recover from a checkpoint using SDP
   /p4/1/bin/p4d_1 -r /p4/1/root -jr -z /p4/p4_1.ckp.2984.gz

== See current connections
   cat /proc/net/nf_conntrack

==Send an email via telnet
  telnet localhost 25
   ehlo localhost 
   mail from: root@localhost
   rcpt to: your_email_id
   data
   Subject: My first mail on Postfix

   Hi, 
   Are you there?
   regards,
   Admin
   .

== Packet sniffing
   sudo tcpflow -i any -C -e port 25

== Get the list of processes with open ports
   lsof -i | grep LISTEN

== Nuke a comment in Swarm
   php public/index.php activity delete -i=[comment id]

== Nuke comment activity for a user
    p4 keys | grep swarm-activity | grep -e '"user":"matt_attaway"' | grep -e '"action":"commented on"' | cut -d'=' -f 1

