Thursday, May 2, 2013

Windows CMD Shell Command Line Syntax


  1. Windows CMD Shell Command Line Syntax
  2. Parameters    Command Line Parameters  %1  %~f1
  3. Variables     Create/read environment variables.
  4. Redirection   Spooling output to a file, piping input.
  5. AND/OR Logic  Conditional Execution (If-Then-Else)
  6. Loops         Loops and Subroutines.
  7. functions     How to package blocks of code.
  8. Services     List of Windows XP Services
  9. Evaluating expressions
  10. Using brackets to Group and expand expressions.
  11. Delayed Expansion Variables within loops.
  12. Escape chars, delimiters and quotes
  13. SET /A        Environment variable arithmetic.
  14. VarSubstring  Extract part of a variable (substring)
  15. VarSearch     Search & replace part of a variable.
  16. RANDOM        Random Numbers.
  17. Wildcards     Match multiple files.
  18.  
  19. Batch Files
  20. Run a script  How to run a script.
  21. DateMath      Add or subtract days from any date.
  22. GetDate.cmd   Get todays date (any region, any OS.)
  23. GetTime.cmd   Get the time now.
  24. GetGMT.cmd    Time adjusted to Greenwich Mean Time.
  25. DeQuote       Remove quotes from a string.
  26. DelOlder      Delete files more than n days old.
  27. StampMe.cmd   Rename a file with the date/time.
  28. tdiff.cmd     Time difference in Hours/Minutes.
  29. Which.cmd     Display full path to any command.
  30. xlong.cmd     Find filenames that exceed the 256 char pathname limit.
  31. DragDrop.cmd  Drag and drop onto a batch script.
  32.  
  33. Reference/How to
  34. Autoexec       Run commands at startup.
  35. Slow Browsing  Speed up network browsing.
  36. Desktop Heap   Memory configuration.
  37. Long Filenames NTFS filename issues.
  38. Display DPI    Monitor size settings.
  39. CMD Internal   Commands that are Internal to the CMD shell.
  40. Keyboard       CMD Keyboard shortcuts.
  41. Printing       Printer connections and print drivers.
  42. Recovery       The Recovery Console.
  43. RUN commands   Start | Run commands.
  44. ProfileFolders Location of User profile folders (XP/Vista/Windows 7).
  45. Registry       User interface settings (XP)
  46. BuiltIn Groups Built-In Users and Security Groups.
  47. Groups         Local Domain groups, Global and Universal groups.
  48. 64Bit          Detect 64 bit vs 32 bit Windows.
  49.  
  50.  
  51.  

Thursday, March 14, 2013

Linux Command


Linux Command Line Cheat Sheet by DaveChild
http://www.cheatography.com/images/icons/comments.png25 Comments   |   http://www.cheatography.com/images/icons/comments_add.png Add a Comment   |   http://www.cheatography.com/images/icons/pdf.png PDF Download   |   http://www.cheatography.com/images/icons/magnifier.png Find: www.minnalinfotech.blogspot.com
Bash Commands
uname -a
Show system and kernel
head -n1 /etc/issue
Show distri­bution
mount
Show mounted filesy­stems
date
Show system date
uptime
Show uptime
whoami
Show your username
man command
Show manual forcommand
Bash Shortcuts
CTRL-c
Stop current command
CTRL-z
Sleep program
CTRL-a
Go to start of line
CTRL-e
Go to end of line
CTRL-u
Cut from start of line
CTRL-k
Cut to end of line
CTRL-r
Search history
!!
Repeat last command
!abc
Run last command starting withabc
!abc:p
Print last command starting withabc
!$
Last argument of previous command
ALT-.
Last argument of previous command
!*
All arguments of previous command
^abc­123
Run previous command, replacingabc with 123
Bash Variables
env
Show enviro­nment variables
echo $NAME
Output value of $NAMEvariable
export NAME­=v­alue
Set $NAME to value
$PATH
Executable search path
$HOME
Home directory
$SHELL
Current shell
IO Redirection
cmd < file
Input of cmd from file
cmd1 <(­cmd2)
Output of cmd2 as file input to cmd1
cmd > file
Standard output (stdout) of cmd to file
cmd > /dev/null
Discard stdout of cmd
cmd >> file
Append stdout to file
cmd 2> file
Error output (stderr) of cmd to file
cmd 1>&2
stdout to same place as stderr
cmd 2>&1
stderr to same place as stdout
cmd &> file
Every output of cmd to file
cmd refers to a command.
Pipes
cmd1 | cmd2
stdout of cmd1 to cmd2
cmd1 |& cmd2
stderr of cmd1 to cmd2
Command Lists
cmd1 ; cmd2
Run cmd1 then cmd2
cmd1 && cmd2
Run cmd2 if cmd1 is successful
cmd1 || cmd2
Run cmd2 if cmd1 is not successful
cmd &
Run cmd in a subshell

Directory Operations
pwd
Show current directory
mkdir dir
Make directory dir
cd dir
Change directory to dir
cd ..
Go up a directory
ls
List files
ls Options
-a
Show all (including hidden)
-R
Recursive list
-r
Reverse order
-t
Sort by last modified
-S
Sort by file size
-l
Long listing format
-1
One file per line
-m
Comma-­sep­arated output
-Q
Quoted output
Search Files
grep patternfiles
Search for pattern in files
grep -i
Case insens­itive search
grep -r
Recursive search
grep -v
Inverted search
grep -o
Show matched part of file only
find /dir/ -name name*
Find files starting with namein dir
find /dir/ -user name
Find files owned by name indir
find /dir/ -mmin num
Find files modifed less thannum minutes ago in dir
whereiscommand
Find binary / source / manual for command
locate file
Find file (quick search of system index)
File Operations
touch file1
Create file1
cat file1 file2
Concat­enate files and output
less file1
View and paginate file1
file file1
Get type of file1
cp file1 file2
Copy file1 to file2
mv file1 file2
Move file1 to file2
rm file1
Delete file1
head file1
Show first 10 lines of file1
tail file1
Show last 10 lines of file1
tail -f file1
Output last lines of file1 as it changes
Process Management
ps
Show snapshot of processes
top
Show real time processes
kill pid
Kill process with id pid
pkillname
Kill process with name name
killallname
Kill all processes with names beginning name

Nano Shortcuts
Files
Ctrl-R
Read file
Ctrl-O
Save file
Ctrl-X
Close file
Cut and Paste
ALT-A
Start marking text
CTRL-K
Cut marked text or line
CTRL-U
Paste text
Navigate File
ALT-/
End of file
CTRL-A
Beginning of line
CTRL-E
End of line
CTRL-C
Show line number
CTRL-_
Go to line number
Search File
CTRL-W
Find
ALT-W
Find next
CTRL-\
Search and replace
Screen Shortcuts
screen
Start a screen session.
screen -r
Resume a screen session.
screen -list
Show your current screen sessions.
CTRL-A
Activate commands for screen.
CTRL-A c
Create a new instance of terminal.
CTRL-A n
Go to the next instance of terminal.
CTRL-A p
Go to the previous instance of terminal.
CTRL-A "
Show current instances of terminals.
CTRL-A A
Rename the current instance.
File Permissions
chmod 775 file
Change mode of file to 775
chmod -R 600 folder
Recurs­ively chmod folder to 600
chown user­:g­roup file
Change file owner to user and group togroup
File Permission Numbers
The first digit is the owner permis­sion, the second the group and the third for everyone.
Calculate each of the three permission digits by adding the numeric values of the permis­sions below.
4
read (r)
2
write (w)
1
execute (x)
uname -a
Show system and kernel

head -n1 /etc/issue
Show distri­bution

mount
Show mounted filesy­stems

date
Show system date

uptime
Show uptime

whoami
Show your username

man command
Show manual forcommand