Windows | Unix | Description |
---|---|---|
attrib | change(clear or set) the attribute of the file | |
cd | pwd | print current working directory |
cd <dir> | cd <dir> | change directory |
cls | clear | clear screen |
cmd | Starts a new instance of the Windows command interpreter | |
copy | cp | copy cp /mySrc . |
date, time | date | print current date and/or time |
del | rm | delete |
deltree | rm - r | recursively delete entire directory tree |
dir | ls | list files and directories ls attributes: -a Include hidden fiels (beginning with .) -l long format -s sort by time modified -r reverse sort |
doskey /h | history | print history |
edit | vi etc. | create new file, show edit window common vi commands: /<text> - search forward n - next occurrence ?<text> - search backward n - previous occurrence :set number - show line number :q | :quit | :q! - quit |
exit | exit Ctrl-D | exit |
find | finds files/folders or string in files Ex. dir c:\ /s /b | find "CPU" - display the file names on drive C that contain the string "CPU" find . -name "foo*" | |
find | grep | search grep -n 'UnknownServiceException' */*/*/server.log grep -rni "string" * .* grep -E "a|b" r = recursive i.e, search subdirectories within the current directory n = to print the line numbers to stdout i = case insensitive search .* = hidden files/directory -E = extended regex (i.e., may use | for or) |
help | man | help/manual displays all available commands & how to use them |
ipconfig /all | ipconfig -a | print network details |
mkdir | mkdir | create new folder/directory |
move | mv | move file or folder |
rmdir | rmdir | remove folder/directory |
set | env | set environment variable |
set Path | echo $PATH | print value of environment var PATH |
start | starting/opening a command/program List of commands for Windows XP, Vista and Windows 7: http://ss64.com/nt/run.html Ex. subst notepad start /d "C:\Program Files (x86)\Notepad++" notepad++.exe -> start the executable and close the command prompt that called it | |
subst | substituting path subst R: D:\temp\temp | |
type | cat | display contents of a file, concatenate files or create a new file Ex. cat > 1.txt This is the first line. - creates a simple text file. ^D mrks the end of file. cat 1.txt - display contents of 1.txt cat 1.txt 2.txt > 3.txt - concatenate 1.txt and 2.txt ans save it in 3.txt |
tree | find ., ls -R | print directory structure |
less | display the contents of a text file on console | |
ln | make link Types: 1. Hard link (default) - Points to a file through inode number. If the original file's name is changed, hard link still points to same file. 2. Symbolic link (ln -s) - Points to a file through name. If the original file's name is changed, symbolic link still points to the original name and does not point anymore to the original file. If the original file's content is changed, symbolic link still points to the same file. ln -s myFolder myShortcut - create ln -sfn myFolder2 myShortcut - update -f = force -n = treat LINK_NAME as a normal file if it is a symbolic link to a directory, else LINK_NAME will be treated as symbolic link and will not effectively remove link to previous target and point to new target | |
printenv | print environment variables | |
tar | archive/extract tar -xvf sample.tar.gz |
PATH
Windows | Unix | Description |
---|---|---|
\ | / | Directory separator, e.g. C:\user\docs\sample.txt |
/ | - | Switch, e.g. dir /w |
[drive letter:]\ or \\[server name]\[volume]\ | / | Root directory |
. | . | Current directory |
.. | .. | Parent directory |
~ | Home directory - $HOME var in UNIX, which usually is /home/username | |
C:\user\docs\sample.txt docs\sample.txt A:pic.jpg \\server01\user\docs\sample.txt | //home/user/docs/Letter.txt
. /inthisdir ../../greatgrandparent ~/.rcinfotd> | Sample paths |
Source:
https://en.wikipedia.org/wiki/Path_(computing)