Dos 跟linux 常用命令对照
Description
MS-DOS
Linux
Linux Example
Copies files
copy
cp
cp
this.txt
that.txt
Moves files
move
mv
mv
this.txt
dir/
Lists files
dir
ls
ls -l
Clears screen
cls
clear
clear
Closes prompt window
exit
exit
exit
Displays or sets date
date
date
date
Deletes files
del
rm
rm
this.txt
"Echoes" output on the screen
echo
echo
echo
this message
Edits files with simple text editor
edit
pico
pico
this.txt
Compares the contents of files
fc
diff
diff
file1
file2
Finds a string of text in a file
find
grep
grep
"this word or phrase"
this.txt
Formats a DOS diskette
format a:
mkfs
mkfs.msdos /dev/fd0
Formats a Linux diskette
N/A
mkfs
mkfs.ext2 /dev/fd0
Formats a Ext3 disk
N/A
mkfs
mkfs.ext3 /dev/hda9
Mount a partition
N/A
mount
mount /dev/hda9 /alt
Unmounts a partition
N/A
umount
umount /alt
Shows mountpoints and types for all mounted drives
N/A
mount
mount
Displays command help
command
/?
man/info
man/info
command
Creates a directory
mkdir
mkdir
mkdir
directory
View a file
more
more/less
more/less
this.txt
Renames a file
ren
mv
mv
this.txt
that.txt
Displays your location in the file system
chdir
pwd
echo $PWD
pwd
echo $PWD
Changes directories with a specified path(absolute path
)
cd
pathname
cd
pathname
cd
/path/to/place/
Changes directories with a
relative path
cd ..
cd ..
cd ../path/
Displays the time
time
date
date
Shows amount of RAM in use
mem
free
free
Shows amount of disk space used
chkdsk
df
df -Th
Reboots the computer
N/A
shutdown
shutdown -r now
Shuts down the computer
N/A
shutdown
shutdown -h now
Print the Routing Table
route print
route
netstat -r
route -n
Print Networking Statistics
netstat
netstat
netstat -nat
Print Networking Settings
ipconfig
ifconfig
ifconfig eth0
Start/Start System Services
net start/stop service
service NAME start/stop
service sshd restart
Disk Partitioning
fdisk
fdisk
fdisk -l /dev/hda
DNS Query
nslookup
host
host -a fortuitous.com
Ping a Host
ping
ping
ping -c5 fortuitous.com
Trace Path to Host
tracert
traceroute
traceroute fortuitous.com
Text Search in File
find
grep
grep banana input.txt