基本指令
 网龙首页 | 操作系统 | 网络硬件 | 组网建网 | 网络建设 | 架站技术 | IT认证 | 网络安全 | 网络存储 | 网龙论坛
首页 >> 操作系统 >> Unix >> 新闻正文

基本指令

http://www.wapease.com/network/ 2004-5-2 浏览次数: [专题阅读]

   我列出了几项基本指令。大部分的指令都有若干选项,这些选项使得这些指令功能更加强大。你可以在Unix在线指南中找到具体的用法。

ls -列出某个子目录中的文件。
语法: ls [选项] [名称]

显示结果应该如同下面的例子:

sutro.hotwired.com[~]% ls

airwolf.au goo.html unixclass

apanel.parameters graphics


在这个例子中,我的用户子目录中有两个文件(airwolf.au和goo.html)和3个下级子目录 (unixclass, apanel.parameters, and graphics) 。

cd - 改变子目录
语法:cd [dir]

例:

sutro.hotwired.com[~]% cd unixclass

sutro.hotwired.com[~/unixclass]% ls

one one.html two two.html

sutro.hotwired.com[~/unixclass]%


在本例中,我从用户子目录改变到unixclass 子目录,在该子目录中有两个文件和一个下级子目录(如果你想返回原来的子目录,则使用% cd ../).

mv - 移动或重命名一个文件或子目录
语法:mv [选项] 源文件/子目录 目标

sutro.hotwired.com[~/unixclass]% mv one/ two/

sutro.hotwired.com[~/unixclass]% ls

one.html two two.html

sutro.hotwired.com[~/unixclass]% ls two/

one

sutro.hotwired.com[~/unixclass]%


我将子目录one移到了子目录two。

如果你用mv重命名一个文件或子目录,则:

sutro.hotwired.com[~/unixclass]% mv two/ somethingdifferent

sutro.hotwired.com[~/unixclass]% ls

one.html somethingdifferent two.html


在本例中我将子目录two重命名为somethingdifferent。

rm - 删除一个文件
语法:rm [选项] [文件]

例:

sutro.hotwired.com[~/unixclass]% rm one.html

sutro.hotwired.com[~/unixclass]% ls

somethingdifferent two.html


我删除了子目录unixclass下的文件。

rm -ir - 删除一个子目录

例:

sutro.hotwired.com[~/unixclass]% rm -ir somethingdifferent/

Directory somethingdifferent/. Remove ? (yes/no)[no] : yes

Directory somethingdifferent//one. Remove ? (yes/no)[no] : yes

sutro.hotwired.com[~/unixclass]% ls

two.html
在本例中,我用rm -ir 指令删除子目录 somethingdifferent。在删除该子目录之前,我必须确认我要删除该子目录。一旦我确认删除之后,子目录 somethingdifferent将不复存在。所以使用 rm时一定要谨慎,因为,一旦执行该命令,该文件或子目录将----覆水难收 ...

mkdir - 建立新子目录
语法:mkdir [选项] 新子目录名
例:

sutro.hotwired.com[~/unixclass]% mkdir waga

sutro.hotwired.com[~/unixclass]% ls

two.html waga
我用mkdir建立了新子目录waga。

more - 分屏过滤或者叫分屏显示(more)一个文件,当你只是想阅读一个文件而不编辑它时。

less - less的功能和more类似,但它还允许你在一个文件内执行查询功能。

exit - 从登录的主机退出

date - 显示当前日期和时间cal 1997 - prints the 1997 calendar

whoami - 显示当前登录到你的终端的用户

mail - 调出一个简单的邮件编辑器

pwd - 告诉你当前你所在的位置,它显示当前子目录的完整路径名。

Unix在线指南

如果你项了解各个指令的细节,你可以查询Unix的在线指南man。例如如果你想了解ls,键入

sutro.hotwired.com[~/unixclass]% man ls
你就会看到:

ls(1)

NAME

ls - list contents of directory

SYNOPSIS

ls [-RadLCxmlnogrtucpFbqisf1AM] [names]

DESCRIPTION

For each directory argument, ls lists the contents of the directory; for

each file argument, ls repeats its name and any other information

requested. The output is sorted alphabetically by default.

Google
 

收藏该文章 | 发送给好友 | 打印该文章 | 我要投稿 | 去论坛讨论

·SCOUNIX如何使用IDE光驱
·SCO UNIX 上 活 动 硬 盘 的 安 装
·SCO UNIX环境下重建Oracle7数据库
·SCO UNIX环境下自动增加网关的两种方法
·SCO UNIX系统故障特征、分析及解决
·SCO UNIX下磁盘设备的应用管理
·UNIX 作业系统操作简介
·SCO XENIX Ver2.3.4中两个有用的DOS拷贝命令

共有评论查看评论
姓名:
发表评论请遵守相关规定!
*《互联网电子公告服务管理规定》
*《全国人大常委会关于维护互联网安全的规定》
万易简介 | 网站简介 | 栏目简介 | 服务报价 | 联系方式 | 万易诚聘 | 版权信息
万易网络 版权所有
www.wapease.com
未经书面许可,任何人不得转载本站信息
联系方式:Info@wapease.com 热线QQ:44977515