CMD Syntax
- Copy - Right-click/Mark/highlight/Enter
- Turn on Properies/Quick Edit Mode to copy with just highlight/enter and paste with right click
- Repeat last command - up arrow
- Mounting share drive
- \10.xx.xx.xxplatform_support
- Username: hostingu154314h
- Press enter to continue - pause
- Arguments to bat files (including drag and drop) = %1 %*
- net use - tells you what partitions you have mounted
Misc Utilities
- gunzip -c (sends to standard out)
- pscp -pw mypassword wamu-logo.jpg u154314@10.174.17.42:
- Copy local file to server (don't forget colon at end, optionally follow colon with path)
Shellscript
Scripts
General
- To input one line at a time instead of one word at a time (e.g. "for line in")
- set/debug options
- set -vx # prints commands before execution
- set -e # terminate the script at first error
- set -u # unset variables are fatal errors
- Sort file based on field 2 with fields delimited by commas
- Same sort but use numeric values in sorting
- Convert text to all uppercase
- Loop through file one line at a time
while read line
do
(do stuff to line)
done < inputfile
awk
- Newline conversion
- IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
- awk '{sub(/\r$/,"");print}' # assumes EACH line ends with Ctrl-M
- IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format
- awk '{sub(/$/,"\r");print}
- IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format
- IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
- Cannot be done with DOS versions of awk, other than gawk:
- gawk -v BINMODE="w" '1' infile >outfile
- Use "tr" instead.
- tr -d \r outfile # GNU tr version 1.22 or higher
- concatenate every 5 lines of input, using a comma separator between fields
- awk 'ORS=%NR%5?",":"n"' file
- print the first three fields of a csv file, (with no " around values)
- awk -F"," '{gsub(/"/, ""); print $1 " " $2 " " $3}'
- Do the same but convert first field to uppercase and 3rd to lowercase
- awk -F"," '{gsub(/"/, ""); print toupper($1) " " $2 " " tolower($3)}'
Cygwin, Windows quirks
- CygwinStartupScript
- vim replacement
- :g,x,s,,y,g - doesn't work
- :g,x,s//y/g - works
- Commands with duplicates in path: find, sort
Vservers/Hosting
- Blocking relayed spam
- save emails to disk and grep (originating) IP
- http://216.122.248.78/vadmin/
- Mail Management / Access Control / Add Access Rules
- Add DISCARD rule for IP range, e.g. 64.224.219.
- Restart sendmail
AD queries
- dsquery user -name u154314 | dsget user -memberof | find /i "bfss" | dsget group -members
- Get object for me | Find groups I'm a member of | grep bfss | List the members of that group
- dsquery group "OU=Mail Lists,OU=WAMU Mail,DC=us,DC=wamu,DC=net" -name "DL ecommerce technology Minstry of Information*" | dsget group -members
Networking, IP
Shinn, William M. says:
here's your $20,000 subnet calculator.... but I'll give it to you for free:
CIDR/bit mask:25 26 27 28 29 30 31 32
Decimal mask:128 192 224 240 248 252 254 255
number of hosts per subnet: 128 64 32 16 8 4 2 1
Andrijeski, Peter says:
So stuff in the 252 range can only contain 4 hosts?
Shinn, William M. says:
yup
Shinn, William M. says:
if the mask is 255.255.255.252, that network will only have 2 hosts.
the first address will be the subnet address, then 2 host addresses, then a broadcast address
that's why on serial links between you and a provider (for example, at least in very small
networks) you usually get a .252 subnet... subnet address, providers router (ser0) and your
router (ser0), then the broadcast address
then they route your public IP ranges to your serial interface
iPod
- Fast forward: Hit center button to toggle bar
Firefox
FirefoxSearchPlugins