Sei sulla pagina 1di 6

Linux/UNIX For DOS Users

Page 1 of 6

UNIX For DOS Users


The following table shows a comparison between DOS (COMMAND.COM and MS/Windows NT CMD.EXE shell commands) and the equivalent Linux/Unix or Bash shell commands.

search
Related YoLinux Tutorials: MS/Windows integration Run MS/Windows software on Linux Using DOS floppies on Linux YoLinux Tutorials Index

Search

| Home Page | Linux Tutorials | Terms | Privacy Policy | Advertising | Contact |

Command Comparison:
DOS Command DIR UNIX or Bash Command Action ls -l (or use ls -lF)(-a all files) List directory contents (df -k Space remaining on filesystem) List directory contents by reverse time of ls -tr modification/creation. ls -ls List files and size ls -R List directory/sub-directory contents ls -a recursively. List hidden files. ls -R List directory recursivly cd Change directory 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 echo $variable ECHO text echo text Echo text to screen 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

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
Ads by Google
Linux PDF Unix Commands Red Hat Linux Unix Linux Hosting C Programming Linux

SET SET variable=value echo %variable%

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Linux/UNIX For DOS Users

Page 2 of 6

Free Information Technology Magazines and Document Downloads

SET variable

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)

Set environment variables

Free Information Technology Software and Development Magazine Subscriptions and Document Downloads

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

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 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. 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

BACKUP files A:\

RESTORE A:\ files

ATTRIB [+r|-r] [+a|-a] chmod [+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: C:\directory\path FORMAT mv file .file lpr source script (cshrc) . script (bash) sh script free top ps -aux top lsdev fsck debugfs du -s fdisk

VER pkzip

HOSTNAME PING TRACERT

Disk usage. Tool to partition a hard drive. Mount a drive letter to a folder/directory on mount your hard drive. mke2fs Format drive file system. See: fdformat and mformat For floppy drive use see YoLinux Tutorial for floppies Using DOS Floppies with Linux uname -a echo $SHELL Operating system/shell version cat /etc/issue Compress and uncompress files/directories. Use tar to create compilation of a directory tar and zip before compressing. Linux also has compress, gzip hostname Print host name of computer ping Send packets to a network host Show routes and router hops to given traceroute network destination. Display/configure network interface Print DNS info for host.

IPCONFIG (NT) ifconfig WINIPCFG (Win 95...) NBTSTAT (Netbios nslookup host-name info: -n, -c) host host-name

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Linux/UNIX For DOS Users

Page 3 of 6

NBTSTAT -A IPaddress NBTSTAT -a hostname ROUTE PRINT NET HELP START NET STARTservicename NET STOPservicename NET SHARES NET SEND <nodename> <message> (NT) WIN REBOOT

nmblookup -A hostname route -n chkconfig --list |grep on

lookup NetBIOS names. Print routing table. List services.

service service-name start Start/stop service/daemon. service service-name stop df smbclient -M MS-Windows -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 / | > >> < UNIX or Bash Descriptor/Operator / ./ ../ ctrl-d ctrl-c * ? $VAR $1 $2 $3 | > >> < 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 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

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Linux/UNIX For DOS Users

Page 4 of 6

IF

if [[ test-resulting-inbool ]]; IF EXIST C:\filename then ... IF NOT EXIST elif ...; C:\filename then ... else ... 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 for ffiillee in lliisstt; do ...; done for (( expr1; expr2; expr3; )) do ...; done $? sleep

if-test If file exists If file does not exist.

Branch

For loop

ERRORLEVEL PAUSE

exit status/return code 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 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'" c:="C:"

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

Equivalent Linux and MS/Windows GUI Applications:


MS/Windows Command C:\WINDOWS\cmd Linux Command Description Command Text Terminal

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Linux/UNIX For DOS Users

Page 5 of 6

gnome-terminal konsole C:\WINDOWS\explorer nautilus --nodesktop c:\Program Files\Internet Explorer\iexplore firefox mozilla C:\WINDOWS\notepad gedit C:\Program Files\Windows NT\Accessories\wordpad C:\Program Files\Microsoft Office\Office10 oowriter \winword oocalc excel ooimpress powerpnt C:\Program Files\Adobe\Acrobat 7.0 acroread \Reader\acrord32 mspaint tuxpaint xfig gimp C:\Program Files\WinZip\winzip32 file-roller taskmgr ksysguard qps gnome-systemmonitor xosview

File browser Web browser Text editor

MS/Office and Open Office suites (ooffice)

Adobe PDF viewer Graphics and painting program

File compress / decompress / pack / unpack Process and system load monitor

Links:
YoLinux Tutorials: Microsoft Windows Network integration tutorial Running Microsoft Windows programs on Linux Links: bash - Bash man page

Books:
"Learning the Bash Shell" by Cameron Newham, Bill Rosenblatt O'Reilly & Associates, ISBN# 1565923472 This book is a great bash shell script book.

"Classic Shell Scripting" by Arnold Robbins, Nelson H.F. Beebe O'Reilly & Associates, ISBN# 0596005954

"Wicked Cool Shell Scripts" by Dave TAylor No Starch Press, ISBN# 1593270127

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Linux/UNIX For DOS Users

Page 6 of 6

"Microsoft Windows Command-Line Administrator's Pocket Consultant" by William R. Stanek Sams, ISBN# 0735620385

"Windows Xp: Command Line" by Carolyn Z. Gillay, Bette A. Peat Sams, ISBN# 1887902821

"Windows XP Under the Hood: Hardcore Windows Scripting and Command Line Power" by Brian Knittel Sams, ISBN# 0789727331

YoLinux.com Home Page YoLinux Tutorial Index |Terms Privacy Policy |Advertise with us | Feedback Form | Unauthorized copying or redistribution prohibited. Copyright 2000-2011 by Greg Ippolito

C Linux
Bookmark saved by

O ver 100 Locat ons, O nlne Program s i i Avaiabl Request a Free Brochure. l e.
w w w . t -t i t ech. edu

430

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

8/17/2011

Potrebbero piacerti anche