您的位置:首页 > 运维架构 > Linux

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS (LINUX 和 WINDOWS的基本命令) part III

2010-08-01 18:29 549 查看
2.4. System Operations: Linux
Just as in Windows, if you are using Linux, a great majority of the commands
that you will use are executed from a console emulation window. Therefore,
we will next learn how to open a console window in Linux.

2.4. 操作系统:Linux

和Windows类似,如果你使用的是Linux系统,你使用的绝大部分命令通过一个控制台仿真窗口执行。

所以,我们首先要学会怎么打开Linux系统的控制台窗口。

2.4.1 How to open a console window
To issue the following commands, it is necessary to open a console window:
1. - To go to the START APPLICATION button
2. - Select “Run Command”
3. - Enter “konsole”
4. - A window similar to the following one will appear:



5. - Now the commands and tools listed below can be entered.

2.4.1 如何打开控制台窗口

为了验证下面的命令,必须要打开一个控制台窗口:

1.-点击开始应用程序

2.-选择“Run Command”

3.-输入“konsole”

4.-会出现和下面图片相似的窗口

5.-现在可以在该窗口中输入下列的命令和工具

2.4.2 Commands and tools (Linux)

Commands

pwd Display the name of the current directory.

hostname Display the name of the local host (the computer which you are currently using)

finger user Display information on the user “user”

Example: finger root

ls List the content of the directories

Example: ls -la

cd directory Change from current directory to “directory”. If no directory name is specified

it changes to the home directory,

Example:
For the login name “mylogin” the command
$cd
changes the directory to /home/mylogin

Example:
$cd -
changes to the last visited directory
Example:
$cd /tmp
changes to the “tmp” directory

cp source dest Copy files. Copy the file “source” to the file “dest”.
Example: cp /etc/passwd /tmp

rm file Delete files. Only the owner of the file (or root) can delete it.
Example: rm myfile

mv source dest Move or rename files and directories.
Example: mv oldname newname

mkdir directory Make a directory with the name “directory”.
Example: mkdir tools

rmdir directory Delete the directory with the name “directory” if it is empty.
Example: rmdir tools

find / -name file Find a file with the name “file” beginning the search in the root
directory
Example: find / -name myfile

echo string Write the string “string” in the standard output
Example: echo hello

command > file Redirect the normal screen output of the command “command”
to the file “file”
Example: ls > myls

command >> file Redirect the normal screen output of the command “command”
to the file “file”. If the file already exists, it appends the output to
the end of the file.
Example: ls >> myls

man command Show the pages of the online manual about “command”
Example: man ls

2.4.2 命令和工具(Linux)

命令:

pwd 显示当前目录

hostname 用以显示或设置系统的主机名称

finger user 显示用户信息

例如:finger root

ls 显示目录内容

例如:ls -la

cd 文件夹名 跳转到指定文件夹,如果没有指定文件夹,跳转到根目录

例如:

如果登录用户名为“mylogin”

命令$cd

跳转到/home/mylogin

例如:

$cd -

跳转到前一次访问的文件夹

例如:

$cd /tmp
跳转到tmp文件夹

cp 源 目标 将源文件中的内容复制到目的文件中

例如: cp /etc/passwd /tmp

rm 文件名 删除文件,只有该文件的所有者才能删除

例如:rm myfile

mv 源 目标 移动或者重命名文件和文件夹

例如: mv 原名 新名

mkdir 文件夹 新建文件夹

例如:mkdir tools

rmdir 文件夹 删除空文件夹

例如:rmdir tools

find / -name 文件 从根目录开始寻找指定文件

例如:find / -name myfile

echo 字符串 标准输出字符串

例如:echo hello

命令 > 文件 将命令执行结果输出到新建文件中

例如:ls > myls

命令 >> 文件 将命令执行结果输出到指定文件夹中,如果文件存在,就写在文件后面

例如:ls >> myls

man 指令 显示含有指定指令的用法手册的网页

例如:man ls

Note: The words in italics are not commands and must be replaced by the desired values.

For additional information on the use of these commands and tools, type in "command
-help" or "man command" in the console window.

For example, for additional information on the “ls” command, type in either of these two
possibilities:
1) ls –-help
2) man ls

说明:斜体字不是指令,要用具体的文件替代,如果想深入了解某些指令的信息,在控制台窗口中输入“command-help”

或者“man command”。

例如:想深入理解“ls“指令的用法,可以通过下面两种键入方式:

1) ls –-help

2) man ls

Tools (Please see the Windows section for details on these tools.)

ping host Verify the contact with the machine “host”
Example: ping www.google.com

traceroute host Show the route that the packets follow to reach the machine
“host”. Example: tracert www.google.com

ifconfig Display information on the active interfaces (ethernet, ppp, etc.)

route Display the routing table

netstat Display information on the status of the network
Example: netstat -an

工具(在Windows工具部分查看这些详细信息)

pong主机 检查主机联网情况

例如:ping www.google.com

路由跟踪主机 显示数据包到达主机的路径

例如:tracert www.google.com

ifconfig 显示电脑中现用界面的信息(局域网,点对点协议,等等)

route 打印路由表

netstat 显示网络状态信息。

例如:netstat -an
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: