Chinaunix首页 | 论坛 | 博客
  • 博客访问: 68073
  • 博文数量: 22
  • 博客积分: 1406
  • 博客等级: 上尉
  • 技术积分: 190
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 13:18
文章分类

全部博文(22)

文章存档

2011年(1)

2010年(21)

我的朋友

分类: LINUX

2010-02-21 20:51:53

Command Comparison:

DOS Command UNIX or Bash Command Action
DIR -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 List directory recursivly
CD Change directory
MKDIR
MD
Make a new directory
ASSIGN Create a file or directory link
RMDIR
RD
Remove a directory
CHDIR Display directory location
DEL
ERASE
-iv Remove a file
RMDIR /S (NT)
DELTREE (Win 95...)
rm -R Remove all directories and files below given directory
COPY -piv Copy a file
XCOPY -R Copy all file of directory recursivly
RENAME or MOVE -iv Rename/move a file
TYPE Dump contents of a file to users screen
MORE Pipe output a single page at a time
HELP or COMMAND /? Online manuals
CLS
ctrl-l
Clear screen
EXIT
EXIT0

exit 0
Exit a shell
FIND
FINDSTR
Look for a word in files given in command line
COMP Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff.
FC 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 Show date. (also set date - DOS only)
DOSKEY /h List command history
DOSKEY NAME=command NAME=command Set command alias
BREAK ON trap Trap ctrl-break / Trap signals.
SORT Sort data alphabetically/numerically
EDLIN Line mode editor
EDIT filename.txt , , , , ,dtpad Edit a file. The Linux editor which looks most like DOS edit is probably Pico. (Not a recomendation!)
BACKUP files A:\ -cvf /dev/fd0 files
,
doswrite -a file (AIX only)
Save files to floppy.
See
RESTORE A:\ files tar -xvf /dev/fd0 files
,
dosread -a file (AIX only)
Read files from floppy.
See
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
ATTRIB +h or -h mv file .file Change file to a hidden file - rename file with prefix "."
PRINT Print a file
CALL
COMMAND /C (DOS), CMD (NT)
script ()
. script ()
sh script
Execute script from within batch shell.
MEM
Show free memory on system
TASKLIST (WIN2K, XP)
List executable name, process ID number and memory usage of active processes
MSD lsdev Show system info (Command borrowed from AIX)
SCANDISK
DEFRAG C:

Check and repair hard drive file system
CHDISK -s Disk usage.
FDISK Tool to partition a hard drive.
SUBST V: C:\directory\path Mount a drive letter to a folder/directory on your hard drive.
FORMAT
See: and for floppies
Format drive file system.
For floppy drive use see
VER -a
echo $SHELL
cat /etc/issue
Operating system/shell version
pkzip and Compress and uncompress files/directories. Use tar to create compilation of a directory before compressing. Linux also has ,
HOSTNAME Print host name of computer
PING Send packets to a network host
TRACERT Show routes and router hops to given network destination.
IPCONFIG (NT)
WINIPCFG (Win 95...)
Display/configure network interface
NBTSTAT (Netbios info: -n, -c)
NBTSTAT -A IP-address
host-name
host-name
Print DNS info for host.
NBTSTAT -a hostname -A hostname lookup NetBIOS names.
ROUTE PRINT -n Print routing table.
NET HELP START --list |grep on List services.
NET STARTservice-name
NET STOPservice-name
service-name start
service-name stop
Start/stop service/daemon.
NET SHARES Show mounted shares/filesystems.
NET SEND (NT) smbclient -M MS-Windows-host-name
Send pop-up to a MS/Windows PC
Send message to another Unix/Linux user. See
WIN Start X-Windows.
REBOOT -r now 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:


Shell Descriptor/Operators:

DOS Descriptor/Operator UNIX or Bash Descriptor/Operator Description
\ / 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
%1 %2 %3 $1 $2 $3 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 UNIX or Bash Operator Description
@
ECHO OFF
set +v 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.
REM # Comment. (Not processed.)
== = string "equal to" comparison
!==! != string "not equal to" comparison
NOT ! negative of test expression
CHOICE case case/switch statement
IF

IF EXIST C:\filename

IF NOT EXIST C:\filename

if [[ test-resulting-in-bool ]];
then
...
elif ...;
then
...
else
...
fi

if [ -e /dir/filename ];
then

if [ ! -e /dir/filename ];
then

if-test

If file exists

If file does not exist.

GOTO ABC
...
:ABC
goto ABC
...
:ABC
Branch
FOR ... IN ... DO

FOR %%fff IN (C:\dir\*.*)
DO echo %%fff

for ffiillee in lliisstt;
do ...;
done

for (( expr1; expr2; expr3; ))
do ...;
done

For loop
ERRORLEVEL $? exit status/return code
PAUSE sleep 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 home directory 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
LPT1
/dev/lp0 First printer device
COM1 /dev/ttyS0 Firsst serial port


Equivalent Linux and MS/Windows GUI Applications:

MS/Windows Command Linux Command Description
C:\WINDOWS\cmd gnome-terminal
konsole
Command Text Terminal
C:\WINDOWS\explorer nautilus --no-desktop File browser
c:\Program Files\Internet Explorer\iexplore firefox
mozilla
Web browser
C:\WINDOWS\notepad
C:\Program Files\Windows NT\Accessories\wordpad
gedit Text editor
C:\Program Files\Microsoft Office\Office10\winword
excel
powerpnt
oowriter
oocalc
ooimpress
MS/Office and Open Office suites (ooffice)
C:\Program Files\Adobe\Acrobat 7.0\Reader\acrord32 acroread Adobe PDF viewer
mspaint tuxpaint
xfig
gimp
Graphics and painting program
C:\Program Files\WinZip\winzip32 file-roller File compress / decompress / pack / unpack
taskmgr ksysguard
qps
gnome-system-monitor
xosview
Process and system load monitor
阅读(1693) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~