basic essentials / teck basic essentials / teck
etc clip art


Additional bits of (useful) information which does not fall easilly into the other sections
DOS and BAT Quick Reference
Some DOS and Batch command may not be used often enough to remember
rem Run as different user
runas /user:Administrator cmd
file commands:
  rem Recursively delete directory
  del /F/Q/S "dirName" > NUL
  rmdir /Q/S "dirName"

  rem as BAT file
  @echo off
  echo Are you sure you want to delete: %CD%?
  pause
  SET currentDir=%CD%
  cd /
  del /F/Q/S "%currentDir%" > NUL
  rmdir /Q/S "%currentDir%"
  exit
	
  
  rem If folder structure to be removed is deep and command prompt 
  rem that RmDir will not delete. 
  rem A side effect of Robocopy can be utilized.  
  rem Example creates an empty directory dummyDir then robocopy the 
  rem empty directory to the directory to be removed with the /MIR 
  rem parameter which means it will purge anything not in the source directory. 
  mkdir dummyDir
  robocopy "dummyDir" "dirToBeDeleted" /MIR	
Add Batch File to Context Menu:
  1. With regeidt go to HKEY_CLASSES_ROOT\Directory\shell\
  2. Right-click on Shell and select New > Key.
  3. Give the Key a name
  4. Right click on the new Key and select New > Key.
  5. Name this Key command
  6. Double click on (Default)
  7. Add cmd /c "cd %1 && theBatchFilename.bat"
Linux Quick Reference
Many Linux command may not be used often enough to remember
Info:
  df #disk space
  whoami #current user name
  pwd  #current directory path
  ls -l #list files -detailed list
  ifconfig #Linux equivalent to DOS ipconfig
  cat /etc/issue  #Linux dist & version
  lsb_release -a  #ubunto version
  printenv #display environment variables
  top / htop #show current processes
  tail -f /logs/access_log #view file contents
Searching:
  #find filename
  find -name fileNameHere.ext 2>/null #suppress permission denied message
  find -name fileNameHere*
  find -name "file Name Here*"
  grep -rn "Text to Search for" /etc/*  #find test in files
  
  #find process by name
  ps aux | grep processNameHere

Dates:
  #set hardware clock
  hwclock --set --localtime --date="12/13/2014 13:57:00"
  #set system clock to hardware clock value
  hwclock --hctosys
  
Advanced RedHat server stuff (other Linux distributions may be different):
  #restart Apache
  service httpd restart
  #restart Tomcat
  [tomcatDirectory]/bin/startup.sh
  
  #restart linux
  /sbin/shutdown -r now

Useful Links
Useful Apache Rewrite Rules found on a nexcess blog