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 cmdfile 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" /MIRAdd Batch File to Context Menu:
- With regeidt go to HKEY_CLASSES_ROOT\Directory\shell\
- Right-click on Shell and select New > Key.
- Give the Key a name
- Right click on the new Key and select New > Key.
- Name this Key command
- Double click on (Default)
- 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 contentsSearching:
#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 processNameHereDates:
#set hardware clock hwclock --set --localtime --date="12/13/2014 13:57:00" #set system clock to hardware clock value hwclock --hctosysAdvanced 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