*NIX Command Equivalents on Windows

By | 22 Jan 2016

Helpful command equivalents between UNIX/Linux and Windows/DOS.

UNIX or Bash Command DOS Command Action
ls -l (or use ls -lF)(-a all files) DIR List directory contents
df -k (Space remaining on filesystem)
ls -tr DIR *.* /o-d List directory contents by reverse time of modification/creation.
ls -ls DIR *.* /v /os List files and size
ls -R DIR /s List directory/sub-directory contents recursively.
ls -a DIR /aa List hidden files.
ls -R TREE List directory recursively
cd CD Change directory
mkdir MKDIR Make a new directory
ln ASSIGN Create a file or directory link
rmdir RMDIR Remove a directory
pwd CHDIR Display directory location
rm -iv DEL Remove a file
rm -R RMDIR /S (NT) Remove all directories and files below given directory
DELTREE (Win 95…)
cp -piv COPY Copy a file
cp -R XCOPY Copy all file of directory recursively
mv -iv RENAME or MOVE Rename/move a file
cat TYPE Dump contents of a file to users screen
more MORE Pipe output a single page at a time
man HELP or COMMAND /? Online manuals
clear CLS Clear screen
exit EXIT Exit a shell
exit 0 EXIT0
grep FIND Look for a word in files given in command line
diff COMP Compare two files and show differences. Also see comm, cmp, mgdiff and
diff FC Compare two files and show differences. Also see comm, cmp, mgdiff and
set and env SET List all environment variables
set SET variable=value 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 export VAR=val (for Korn shell. Also VAR=val) SET variable Set environment variables
echo $PATH PATH Display search path for executable.
PATH=$PATH:/dir PATH %PATH%;C:\DIR Set PATH environment variable.
export PS1=’\h(\u)\W> ‘ PROMPT $p$g Set user command prompt.
date DATE or TIME Show date. (also set date – DOS only)
history DOSKEY /h List command history
alias NAME=command DOSKEY NAME=command Set command alias
trap BREAK ON Trap ctrl-break / Trap signals.
sort SORT Sort data alphabetically/numerically
ed EDLIN Line mode editor
pico, gnp, vi, xedit, xemacs,dtpad EDIT filename.txt Edit a file. The Linux editor which looks most like DOS edit is probably
Pico. (Not a recommended!)
tar -cvf /dev/fd0 files BACKUP files A:\ Save files to floppy.
mdir, mcopy See Using DOS floppies
doswrite -a file (AIX only)
tar -xvf /dev/fd0 files RESTORE A:\ files Read files from floppy.
mdir, mcopy See Using DOS floppies
dosread -a file (AIX only)
chmod ATTRIB [+r|-r] [+a|-a] [+s|-s] [path\file] /s Change file permissions. DOS: +:set to -:remove r:Read only a:Archive
s:System /s:recursively
mv file .file ATTRIB +h or -h Change file to a hidden file – rename file with prefix “.”
lpr PRINT Print a file
source script (cshrc) CALL Execute script from within batch shell.
. script (bash) COMMAND /C (DOS), CMD (NT)
sh script
free MEM Show free memory on system
ps -aux TASKLIST (WIN2K, XP) List executable name, process ID number and memory usage of
active processes
lsdev MSD Show system info (Command borrowed from AIX)
fsck SCANDISK Check and repair hard drive file system
debugfs DEFRAG C:
du -s CHDISK Disk usage.
fdisk FDISK Tool to partition a hard drive.
mount SUBST V: C:\directory\path Mount a drive letter to a folder/directory on your hard drive.
mke2fs FORMAT Format drive file system.
See: fdformat and mformat for floppies For floppy drive use see YoLinux Tutorial Using DOS Floppies with Linux
uname -a VER Operating system/shell version
echo $SHELL
cat /etc/issue
tar and zip pkzip 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
traceroute TRACERT Show routes and router hops to given network destination.
ifconfig IPCONFIG (NT) Display/configure network interface
WINIPCFG (Win 95…)
nslookup host-name NBTSTAT (Netbios info: -n, -c) Print DNS info for host.
host host-name NBTSTAT -A IP-address
nmblookup -A hostname NBTSTAT -a hostname lookup NetBIOS names.
route -n ROUTE PRINT Print routing table.
chkconfig –list |grep on NET HELP START List services.
service service-name start NET STARTservice-name Start/stop service/daemon.
service service-name stop NET STOPservice-name
df NET SHARES Show mounted shares/filesystems.
smbclient -M MS-Windows-host-name NET SEND <node-name> <message> (NT) Send pop-up to a MS/Windows PC
talk Send message to another Unix/Linux user.
startx WIN Start X-Windows.
shutdown -r now shutdown -r -t 0 Reboot system.

Leave a Reply

Your email address will not be published. Required fields are marked *