Friday, October 30, 2009

Windows DOS commands VS unix commands

Hi all this is a comparison of DOs commands VS unix commands. As contary to Unix commands Doc commands are not that much famous. But this table will help you to compare the commands and to use them.

DOS Command
UNIX or Bash Command
Action
DIR
ls -l (or use ls -lF)(-a all files)
(df -k Space remaining on filesystem)
List directory contents
DIR *.* /o-d
DIR *.* /v /os
DIR /s
DIR /aa
ls -tr
ls -ls
ls -R
ls -a
List directory contents by reverse time of modification/creation.
List files and size
List directory/sub-directory contents recursively.
List hidden files.
TREE
ls -R
List directory recursivly
CD
cd
Change directory
MKDIR
MD
mkdir
Make a new directory
ASSIGN
ln
Create a file or directory link
RMDIR
RD

rmdir
Remove a directory
CHDIR
pwd
Display directory location
DEL
ERASE
rm -iv
Remove a file
RMDIR /S (NT)
DELTREE (Win 95...)
rm -R
Remove all directories and files below given directory
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 COMMAND /?
man
Online manuals
CLS
clear
ctrl-l
Clear screen
EXIT
EXIT0
exit
exit 0
Exit a shell
FIND
FINDSTR
grep
Look for a word in files given in command line
COMP
diff
Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff.
FC
diff
Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff.
SET
set and env
List all environment variables
SET variable=value
echo %variable%
set
export variable=value
echo $variable
Set environment variables
Show environment variables
ECHO text
echo text
Echo text to screen
SET variable
setenv (for C shell) or export VAR=val (for Korn shell. Also VAR=val)
Set environment variables
PATH
PATH %PATH%;C:\DIR
echo $PATH
PATH=$PATH:/dir
Display search path for executables.
Set PATH environment variable.
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 NAME=command
alias NAME=command
Set command alias
BREAK ON
trap
Trap ctrl-break / Trap signals.
SORT
sort
Sort data alphabetically/numerically
EDLIN
ed
Line mode editor
EDIT filename.txt
pico, gnp, vi, xedit, xemacs,dtpad
Edit a file. The Linux editor which looks most like DOS edit is probably Pico. (Not a recomendation!)
BACKUP files A:\
tar -cvf /dev/fd0 files
mdir, mcopy
doswrite -a file (AIX only)
Save files to floppy.
See Using DOS floppies
RESTORE A:\ files
tar -xvf /dev/fd0 files
mdir, mcopy
dosread -a file (AIX only)
Read files from floppy.
See Using DOS floppies
ATTRIB [+r|-r] [+a|-a] [+s|-s] [path\file] /s
chmod
Change file permissions. DOS: +:set to -:remove r:Read only a:Archive s:System /s:recursively
ATTRIB +h or -h
mv file .file
Change file to a hidden file - rename file with prefix "."
PRINT
lpr
Print a file
CALL
COMMAND /C (DOS), CMD (NT)
source script (cshrc)
. script (bash)
sh script
Execute script from within batch shell.
MEM
free
top
Show free memory on system
TASKLIST (WIN2K, XP)
ps -aux
top
List executable name, process ID number and memory usage of active processes
MSD
lsdev
Show system info (Command borrowed from AIX)
SCANDISK
DEFRAG C:
fsck
debugfs
Check and repair hard drive file system
CHDISK
du -s
Disk usage.
FDISK
fdisk
Tool to partition a hard drive.
SUBST V: C:\directory\path
mount
Mount a drive letter to a folder/directory on your hard drive.
FORMAT
mke2fs
See: fdformat and mformat for floppies
Format drive file system.
VER
uname -a
echo $SHELL
cat /etc/issue
Operating system/shell version
pkzip
tar and zip
Compress and uncompress files/directories. Use tar to create 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
TRACERT
traceroute
Show routes and router hops to given network destination.
IPCONFIG (NT)
WINIPCFG (Win 95...)
ifconfig
Display/configure network interface
NBTSTAT (Netbios info: -n, -c)
NBTSTAT -a host-name
NBTSTAT -A IP-address
nslookup host-name
host host-name
Print DNS info for host.
ROUTE PRINT
route -n
Print routing table.
NET HELP START
chkconfig --list |grep on
List services.
NET STARTservice-name
NET STOPservice-name
service service-name start
service service-name stop
Start/stop service/daemon.
NET SHARES
df
Show mounted shares/filesystems.
NET SEND (NT)
smbclient -M MS-Windows-host-name
talk
Send pop-up to a MS/Windows PC
Send message to another Unix/Linux user. See YoLinux tutorial
WIN
startx
Start X-Windows.
REBOOT
shutdown -r now
Reboot system.

3 comments:

  1. Hi Ritesh,

    Thanks for posting these commands...

    I am a new learner of Unix and just need the interesting way to learn.

    Please help me...

    nikunj.chandra007@gmail.com

    ReplyDelete
  2. Sorry for being dump..

    "sc query" in windows lists the windows services, what is the equalant command in unix.

    ps -auX - lists unix process
    Tasklist - lists windows process

    sc query - lists windows services
    ?? - Unix Services

    ReplyDelete