You are on page 1of 7

Command Comparison:

DOS Command DIR UNIX or Bash Command ls -l (or use ls -lF)(-a all files) (df -k Space remaining on filesystem) ls -tr ls -ls ls -R ls -a Action List directory contents

DIR *.* /o-d DIR *.* /v /os DIR /s DIR /aa

TREE CD MKDIR MD ASSIGN RMDIR RD CHDIR DEL ERASE RMDIR /S (NT) DELTREE (Win 95...) COPY XCOPY RENAME or MOVE TYPE MORE HELP or COMMAND /? CLS EXIT EXIT0 FIND FINDSTR COMP FC SET SET variable=value echo %variable%

ls -R cd mkdir ln rmdir pwd rm -iv rm -R cp -piv cp -R mv -iv cat more man clear ctrl-l exit exit 0 grep diff diff set and env set export variable=value

List directory contents by reverse time of modification/creation. List files and size List directory/sub-directory contents recursively. List hidden files. List directory recursivly Change directory Make a new directory Create a file or directory link Remove a directory Display directory location Remove a file Remove all directories and files below given directory Copy a file Copy all file of directory recursivly Rename/move a file Dump contents of a file to users screen Pipe output a single page at a time Online manuals Clear screen Exit a shell Look for a word in files given in command line Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff. Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff. List all environment variables Set environment variables Show environment variables

ECHO text SET variable

PATH PATH %PATH%;C:\DIR PROMPT $p$g DATE or TIME DOSKEY /h DOSKEY NAME=command BREAK ON SORT EDLIN EDIT filename.txt

echo $variable echo text setenv (for C shell) or export VAR=val (for Korn shell. Also VAR=val) echo $PATH PATH=$PATH:/dir export PS1='\h(\u)\W> ' date history alias NAME=command trap sort ed pico, gnp, vi, xedit, xemacs,dtpad tar -cvf /dev/fd0 files mdir, mcopy doswrite -a file (AIX only) tar -xvf /dev/fd0 files mdir, mcopy dosread -a file (AIX only) chmod

Echo text to screen Set environment variables

Display search path for executables. Set PATH environment variable. Set user command prompt. Show date. (also set date - DOS only) List command history Set command alias Trap ctrl-break / Trap signals. Sort data alphabetically/numerically Line mode editor Edit a file. The Linux editor which looks most like DOS edit is probably Pico. (Not a recomendation!) Save files to floppy. See Using DOS floppies

BACKUP files A:\

RESTORE A:\ files

Read files from floppy. See Using DOS floppies Change file permissions. DOS: +:set to :remove r:Read only a:Archive s:System /s:recursively Change file to a hidden file - rename file with prefix "." Print a file Execute script from within batch shell.

ATTRIB [+r|-r] [+a|a] [+s|-s] [path\file] /s ATTRIB +h or -h PRINT CALL COMMAND /C (DOS), CMD (NT) MEM TASKLIST (WIN2K, XP) MSD SCANDISK DEFRAG C: CHDISK FDISK SUBST V:

mv file .file lpr source script (cshrc) . script (bash) sh script free top ps -aux top lsdev fsck debugfs du -s fdisk mount

Show free memory on system List executable name, process ID number and memory usage of active processes Show system info (Command borrowed from AIX) Check and repair hard drive file system Disk usage. Tool to partition a hard drive. Mount a drive letter to a folder/directory

C:\directory\path FORMAT

VER

pkzip

mke2fs See: fdformat and mformat for floppies uname -a echo $SHELL cat /etc/issue tar and zip

on your hard drive. Format drive file system. For floppy drive use see YoLinux Tutorial Using DOS Floppies with Linux Operating system/shell version

HOSTNAME PING TRACERT IPCONFIG (NT) WINIPCFG (Win 95...) NBTSTAT (Netbios info: -n, -c) NBTSTAT -A IPaddress NBTSTAT -a hostname ROUTE PRINT NET HELP START NET STARTservicename NET STOPservicename NET SHARES NET SEND <nodename> <message> (NT) WIN REBOOT

hostname ping traceroute ifconfig

Compress and uncompress files/directories. Use tar to create compilation of a directory before compressing. Linux also has compress, gzip Print host name of computer Send packets to a network host Show routes and router hops to given network destination. Display/configure network interface

nslookup host-name host host-name

Print DNS info for host.

nmblookup -A hostname route -n chkconfig --list |grep on service service-name start service service-name stop

lookup NetBIOS names. Print routing table. List services. Start/stop service/daemon.

df smbclient -M MSWindows-host-name talk startx shutdown -r now

Show mounted shares/filesystems. Send pop-up to a MS/Windows PC Send message to another Unix/Linux user. See YoLinux tutorial Start X-Windows. Reboot system.

To find out how to do something on UNIX simply type "man -k subject_matter". This will do a key word search for all commands dealing with the subject matter. Then use the appropriate command. Online manuals are available on all the commands by typing "man command_name". MS/Windows info:

http://www.mcmcse.com/

http://www.techtutorials.net/

Shell Descriptor/Operators:
DOS Descriptor/Operator \ .\ ..\ ctrl-z ctrl-c * ? %VAR% %1 %2 %3 / | > >> < / ./ ../ ctrl-d ctrl-c * ? $VAR $1 $2 $3 | > >> < UNIX or Bash Descriptor/Operator Description Directory path delimiter Current directory Parent directory End of file/close shell Interrupt/process break file name wild card Single character wild card Variable prefix First, second and third shell command line arguments. Command line option flag prefix Pipe stdout redirection stdout redirection overwrite stdin redirection

Shell Script Operators:


DOS Operator @ ECHO OFF % REM == !==! NOT CHOICE IF UNIX or Bash Operator set +v $ # = != ! case Description Set verbose mode off. -v: Echo each line of shell script as it is executed. command line argument prefix. DOS: %1 Bash: $1 for firs argument. Comment. (Not processed.) string "equal to" comparison string "not equal to" comparison negative of test expression case/switch statement

if [[ test-resulting-in- if-test bool ]]; then

... IF EXIST C:\filename elif ...; then ... IF NOT EXIST else C:\filename ... fi if [ -e /dir/filename ]; then if [ ! -e /dir/filename ]; then GOTO ABC ... :ABC FOR ... IN ... DO FOR %%fff IN (C:\dir\*.*) DO echo %%fff goto ABC ... :ABC

If file exists If file does not exist.

Branch

for ffiillee in lliisstt; For loop do ...; done for (( expr1; expr2; expr3; )) do ...; done $? sleep exit status/return code sleep for specified interval

ERRORLEVEL PAUSE

Bash shell aliases for DOS users:


The following are bash shell aliases which can be added to the system profile or the user's personal profile ($HOME/.bashrc) to correct and help DOS users on Linux.
alias alias alias alias alias alias alias alias alias alias alias alias alias dir="echo 'Use the command: ls -lF'" tree="echo 'Use the command: ls -R'" del="echo 'Use the command: rm -iv'" move="echo 'Use the command: mv -iv'" rename="echo 'Use the command: mv -iv'" copy="echo 'Use the command: cp -piv'" type="echo 'Use the command: cat'" cls="echo 'Use the command: clear'" mem="echo 'Use the command: free'" ver="echo 'Use the command: uname -a'" A:="echo 'Use the command: mdir a:'" a:="A:" C:="echo 'No C drive in Linux. Go to your home directory with the

command: cd'" alias c:="C:"

Devices:
DOS Device Linux Device Description NUL /dev/null Send into nothingness CON PRN LPT1 COM1 stdin /dev/lp0 /dev/ttyS0 stdin from console First printer device Firsst serial port

Equivalent Linux and MS/Windows GUI Applications:


MS/Windows Command C:\WINDOWS\cmd C:\WINDOWS\explorer c:\Program Files\Internet Explorer\iexplore C:\WINDOWS\notepad C:\Program Files\Windows NT\Accessories\wordpad C:\Program Files\Microsoft Office\Office10\winword excel powerpnt C:\Program Files\Adobe\Acrobat 7.0\Reader\acrord32 mspaint Linux Command gnome-terminal konsole nautilus --nodesktop firefox mozilla gedit Description Command Text Terminal File browser Web browser Text editor

oowriter oocalc ooimpress acroread tuxpaint xfig gimp file-roller ksysguard qps gnome-systemmonitor xosview

MS/Office and Open Office suites (ooffice)

Adobe PDF viewer Graphics and painting program File compress / decompress / pack / unpack Process and system load monitor

C:\Program Files\WinZip\winzip32 taskmgr

Links:

You might also like