Command Comparison
Command Comparison: UNIX or Bash DOS Command Action Command DIR ls -l (or use ls -lF)(-a all files) List directory contents (df -k Space remaining on filesystem) DIR *.* /o-d List directory contents by reverse time of DIR *.* /v /os ls -tr modification/creation. DIR /s ls -ls List files and size DIR /aa ls -R List directory/sub-directory contents ls -a recursively. List hidden files. TREE ls -R List directory recursivly CD cd Change directory MKDIR mkdir Make a new directory MD ASSIGN ln Create a file or directory link RMDIR rmdir Remove a directory RD CHDIR pwd Display directory location DEL rm -iv Remove a file ERASE RMDIR /S (NT) Remove all directories and files below DELTREE (Win rm -R given directory 95...) COPY cp -piv Copy a file XCOPY cp -R Copy all file of directory recursivly RENAME or MOVE mv -iv Rename/move a file TYPE cat Dump contents of a file to users screen MORE more Pipe output a single page at a time HELP or man Online manuals COMMAND /? clear CLS Clear screen ctrl-l EXIT exit Exit a shell EXIT0 exit 0 FIND Look for a word in files given in grep FINDSTR command line Compare two files and show differences. COMP diff Also see comm, cmp, mgdiff and tkdiff. Compare two files and show differences. FC diff Also see comm, cmp, mgdiff and tkdiff. SET set and env List all environment variables SET variable=value set Set environment variables echo %variable% Show environment variables export variable=value echo $variable ECHO text echo text Echo text to screen setenv (for C shell) or SET variable export VAR=val (for Korn Set environment variables shell. Also VAR=val) PATH echo $PATH Display search path for executables. PATH PATH=$PATH:/dir Set PATH environment variable. %PATH%;C:\DIR PROMPT $p$g export PS1='\h(\u)\W> ' Set user command prompt. DATE or TIME date Show date. (also set date - DOS only) DOSKEY /h history List command history DOSKEY alias NAME=command Set command alias NAME=command BREAK ON trap Trap ctrl-break / Trap signals. SORT sort Sort data alphabetically/numerically EDLIN ed Line mode editor EDIT filename.txt Edit a file. The Linux editor which looks pico, gnp, vi, xedit, most like DOS edit is probably Pico. xemacs,dtpad (Not a recomendation!) BACKUP files A:\ tar -cvf /dev/fd0 files mdir, mcopy Save files to floppy. doswrite -a file (AIX See Using DOS floppies only) tar -xvf /dev/fd0 files Read files from floppy. RESTORE A:\ files mdir, mcopy See Using DOS floppies dosread -a file (AIX only) Change file permissions. DOS: +:set to - ATTRIB [+r|-r] [+a|- chmod :remove r:Read only a:Archive s:System a] [+s|-s] [path\file] /s /s:recursively Change file to a hidden file - rename file ATTRIB +h or -h mv file .file with prefix "." PRINT lpr Print a file CALL source script (cshrc) COMMAND /C . script (bash) Execute script from within batch shell. (DOS), CMD (NT) sh script MEM free Show free memory on system top TASKLIST (WIN2K, ps -aux List executable name, process ID number XP) top and memory usage of active processes Show system info (Command borrowed MSD lsdev from AIX) SCANDISK fsck Check and repair hard drive file system DEFRAG C: debugfs CHDISK du -s Disk usage. FDISK fdisk Tool to partition a hard drive. SUBST V: Mount a drive letter to a folder/directory mount C:\directory\path on your hard drive. FORMAT mke2fs Format drive file system. See: fdformat and For floppy drive use see YoLinux mformat for floppies Tutorial Using DOS Floppies with Linux uname -a VER echo $SHELL Operating system/shell version cat /etc/issue pkzip Compress and uncompress files/directories. Use tar to create tar and zip compilation of a directory before compressing. Linux also has compress, gzip HOSTNAME hostname Print host name of computer PING ping Send packets to a network host Show routes and router hops to given TRACERT traceroute network destination. IPCONFIG (NT) WINIPCFG (Win ifconfig Display/configure network interface 95...) NBTSTAT (Netbios nslookup host-name Print DNS info for host. info: -n, -c) host host-name NBTSTAT -A IP- address NBTSTAT -a nmblookup -A hostname lookup NetBIOS names. hostname ROUTE PRINT route -n Print routing table. NET HELP START chkconfig --list |grep on List services. NET STARTservice- name service service-name start Start/stop service/daemon. NET STOPservice- service service-name stop name NET SHARES df Show mounted shares/filesystems. NET SEND
Shell Script Operators: UNIX or Bash DOS Operator Description Operator @ Set verbose mode off. -v: Echo each line of set +v ECHO OFF shell script as it is executed. command line argument prefix. DOS: %1 % $ Bash: $1 for firs argument. REM # Comment. (Not processed.) == = string "equal to" comparison !==! != string "not equal to" comparison NOT ! negative of test expression CHOICE case case/switch statement IF if [[ test-resulting-in- if-test bool ]]; IF EXIST C:\filename then If file exists ... IF NOT EXIST elif ...; If file does not exist. C:\filename then ... else ... fi
if [ -e /dir/filename ]; then
if [ ! -e /dir/filename ]; then GOTO ABC goto ABC Branch ...... :ABC :ABC FOR ... IN ... DO for ffiillee in lliisstt; For loop do ...; FOR %%fff IN done (C:\dir\*.*) DO echo %%fff for (( expr1; expr2; expr3; )) do ...; done ERRORLEVEL $? exit status/return code PAUSE sleep sleep for specified interval
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 dir="echo 'Use the command: ls -lF'" alias tree="echo 'Use the command: ls -R'" alias del="echo 'Use the command: rm -iv'" alias move="echo 'Use the command: mv -iv'" alias rename="echo 'Use the command: mv -iv'" alias copy="echo 'Use the command: cp -piv'" alias type="echo 'Use the command: cat'" alias cls="echo 'Use the command: clear'" alias mem="echo 'Use the command: free'" alias ver="echo 'Use the command: uname -a'" alias A:="echo 'Use the command: mdir a:'" alias a:="A:" alias 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 stdin stdin from console PRN /dev/lp0 First printer device LPT1 COM1 /dev/ttyS0 Firsst serial port Equivalent Linux and MS/Windows GUI Applications: Linux MS/Windows Command Description Command C:\WINDOWS\cmd gnome-terminal Command Text Terminal konsole C:\WINDOWS\explorer nautilus --no- File browser desktop c:\Program Files\Internet firefox Web browser Explorer\iexplore mozilla C:\WINDOWS\notepad gedit Text editor C:\Program Files\Windows NT\Accessories\wordpad C:\Program Files\Microsoft oowriter MS/Office and Open Office Office\Office10\winword oocalc suites (ooffice) excel ooimpress powerpnt C:\Program Files\Adobe\Acrobat acroread Adobe PDF viewer 7.0\Reader\acrord32 mspaint tuxpaint Graphics and painting xfig program gimp C:\Program Files\WinZip\winzip32 file-roller File compress / decompress / pack / unpack taskmgr ksysguard Process and system load qps monitor gnome-system- monitor xosview