UNIX 常用命令简介(1)

1)登录工作站
==========
执行格式 telnet hostname     (在 dos 下执行)
          telnet ip-address
Example:

          telnet doc           telnet 140.122.77.120

注: 可利用指令 arp hostname 或 arp domain_name 查询 ip_address

.登录步骤
=========

login    : _______  => 输入 username

password : _______  => 输入密码

2)退出步骤
=========
        % logout    或  % exit    或  % 

更改帐号密码
============

% passwd      => 执行後将会出现下列讯息

Changing NIS password for user on ice.

Old password: ______       => 输入旧密码

New password: ______       => 输入新密码(最好6-8字 英文字母与数字混合)

Retype new password: ______ => 再输入一次密码


3)联机手册man
============
执行格式  man command-name

Example:  % man ls

进入远端电脑系统
================
执行格式 rlogin hostname [-1 username]

Example:

%rlogin doc

        remote login 进入工作站 doc 中 

%rlogin doc -l user

        使用 user 帐号进入工作站 doc 中 

执行格式 telnet hostname 或 telnet IP address

Example: %telnet doc    or %telnet 140.109.20.251

4)档案或目录处理Ls
==================

?列出档案或目录下之档案名称

  执行格式  ls [-atFlgR] [name]  ( name 可为档名或目录名称 )

Example :

ls      列出目前目录下之档名 

ls -a   列出包含以?起始的隐藏档所有档名 

ls -t    依照档案最後修改时间之顺序 依序列出档名 

ls -F   列出目前目录下之档名及其类型 "/" 结尾表示为目录名称 

        "*" 结尾表示为执行档 "@" 结尾表示为 symblic link 

ls -l   列出目录下所有档案之许可权 拥有者 档案大小 修改时间及名称 

ls -lg   同上 并显示出档案之拥有者群组名称 

ls -R   显示出目录下 以及其所有子目录之档名 ( recursive listing )

5)查找文件Find
Finding Files that Match a Pattern
$ find . -name 'd*'

The dot (.) causes

find to search the current directory and its

subdirectories. The

-name option followed by a file name or a file name

pattern (in this case

d*) tells find to search for all file names that match

that pattern. In this example,

find will look for all file names beginning

with

d. Note that d* is enclosed by single quotes 'd*'.

$

find /home/leslie -newer myfile

This example can be read as follows: in directory

/home/leslie and its

subdirectories, find all files modified after

myfile. (To determine when a

file was last modified, use the

ll command.)

$

find . -name '*.tmp' -exec rm {} /;You can execute commands on files located with the find command. Let's
say you want to remove all files with a extension in thecurrent directory
and its subdirectories. 

To find files that do not match a specific pattern, use the logical NOT

operator, the exclamation mark (

!). After using this operator, you must

use options to define file attributes such as file name. Then, files are

found that do

not have the attributes you specify.

For example, to find all files in

/tmp that are not owned by leslie, use

this command:

$

find /tmp /( ! -user leslie /)

The

/ escapes the parentheses so that they are not interpreted as special

characters by the shell.

To find files that have two distinct attributes, use the logical AND

operator,

expression -a expression. For example, to find all directories in /

that are owned by

leslie, use this command:

$

find / /( -type d -a -user leslie /)

To find files that have either or both of two attributes, use the logical OR

operator,

expression -o expression. For example, to remove all files ending

with

.o or named a.out that have not been accessed for a week, use this

command:

$

find / /( -name a.out -o -name '*.o' /) -atime +7 -exec rm {} /;

6)目录之缩写Cd
===========

~       使用者 login 时的 working directory ( 起始目录 )

~username   指定某位 user 的 working directory ( 起始目录 )

.            目前的工作目录 ( current working directory )

..           目前目录的上一层目录 ( parent of working directory)

改变工作目录位置

================

执行格式 cd  [name]    name 可为目录名称 路径或目录缩写 

Example:

cd         改变目录位置 至使用者 login 时的 working directory (起始目录) 

cd  dir1   改变目录位置 至 dir1 之目录位置下 

cd ~user   改变目录位置 至使用者的 working directory (起始目录) 

cd  ..     改变目录位置 至目前目录的上层( 即 parent of working directory)

cd  ../user     改变目录位置 至相对路径 user 之目录位置下 

cd  /../..      改变目录位置 至绝对路径( Full path ) 之目录位置下 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值