Quick viewing(Text Mode)

Command Comparison

Command Comparison

Command Comparison: or DOS Action Command -l (or use ls -lF)(-a all files) List contents ( -k Space remaining on filesystem) DIR *.* /o-d List directory contents by reverse of DIR *.* / /os ls - 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. ls -R List directory recursivly cd Change directory mkdir a new directory MD ASSIGN Create a or directory rmdir Remove a directory RD CHDIR Display directory location -iv Remove a file ERASE RMDIR /S (NT) Remove all directories and files below DELTREE (Win rm -R given directory 95...) -piv Copy a file XCOPY cp -R Copy all file of directory recursivly RENAME or -iv Rename/move a file contents of a file to users screen more Pipe output a single page a time or man Online manuals COMMAND /? Clear screen ctrl-l exit Exit a EXIT0 exit 0 Look for a word in files given in command line Compare two files and show differences. Also see , , mgdiff and tkdiff. Compare two files and show differences. diff Also see comm, cmp, mgdiff and tkdiff. SET set and List all environment variables SET variable=value set Set environment variables %variable% Show environment variables export variable=value echo $variable ECHO text echo text Echo text to screen setenv (for shell) or SET variable export VAR=val (for Korn Set environment variables shell. Also VAR=val) PATH echo $PATH Display search for executables. PATH PATH=$PATH:/dir Set PATH . %PATH%;C:\DIR PROMPT $p$g export PS1='\h(\u)\> ' Set command prompt. DATE or TIME date Show date. (also set date - DOS only) DOSKEY /h List command history DOSKEY NAME=command Set command alias NAME=command BREAK ON trap Trap ctrl-break / Trap signals. sort Sort data alphabetically/numerically Line mode editor EDIT filename.txt Edit a file. The editor looks pico, gnp, , xedit, like DOS edit is probably Pico. xemacs,dtpad (Not a recomendation!) BACKUP files A:\ -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|- :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 (WIN2K, -aux List executable name, ID number XP) top and memory usage of active processes Show system (Command borrowed MSD lsdev from AIX) SCANDISK Check and repair hard drive DEFRAG C: debugfs CHDISK -s Disk usage. fdisk Tool to partition a hard drive. SUBST V: a drive letter to a folder/directory mount C:\directory\path on your hard drive. mke2fs Format drive file system. See: fdformat and For floppy drive use see YoLinux mformat for floppies Tutorial Using DOS Floppies with Linux -a echo $SHELL /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 name of computer PING ping Send packets to a network host Show routes and router hops to given TRACERT network destination. (NT) WINIPCFG (Win Display/configure network interface 95...) NBTSTAT (Netbios 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 PRINT route -n Print routing table. HELP 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 Windows-host-name Send message to another Unix/Linux (NT) user. See YoLinux tutorial WIN startx Start X-Windows. REBOOT -r now Reboot system. Shell Descriptor/Operators: DOS UNIX or Bash Description Descriptor/Operator Descriptor/Operator \ / Directory path delimiter .\ ./ Current directory ..\ ../ Parent directory ctrl-z ctrl-d End of file/close shell ctrl-c ctrl-c Interrupt/process break * * file name wild card ? ? Single character wild card %VAR% $VAR Variable prefix First, second and third shell %1 %2 %3 $1 $2 $3 command line arguments. / - Command line option flag prefix | | Pipe > > stdout >> >> stdout redirection overwrite < < stdin redirection

Shell Script Operators: UNIX or Bash DOS Operator Description Operator @ Set verbose mode off. -v: Echo each line of set +v ECHO OFF 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 expression 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 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 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- Command Text Terminal konsole C:\WINDOWS\explorer nautilus --no- File browser desktop c:\\Internet Explorer\iexplore mozilla C:\WINDOWS\notepad gedit Text editor C:\Program Files\Windows NT\Accessories\wordpad C:\Program Files\ 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