基本 Unix 命令 - abstract

基本 Unix 命令 - abstract:

file foo: 显示foo文件的属性。
type commandname: 显示命令 commandname的信息。
apropos key-word: 找到和key-word相关的命令。man -k key-word也可以。
whatis commandname: 显示commandname的一句话帮助。
lsof foo: 显示文件foo的打开状态。
cd: 切换到用户主目录。
cd -: 切换到上一次所去的目录。
touch junkfile: 创建一个空文件junkfile。
mv foo bar: 把已有的foo文件重新命名为bar。
grep -e "pattern" *.html: 找到当前目录下面所有以.html结尾的文件中含有"pattern"的行,并显示它们。

Shell 通配符

*      这个匹配0个或者多个字符。
       它不会匹配以"."开始的文件名.

?      这个仅匹配一个字符。

[...]     这个匹配[]里面的某个字符。

[a-z]    这个匹配字符a到z之间的某个字符。

[^...]    这个匹配任意不包含在[]里面的字符(不包含字符"^").

example:
     $ mkdir junk; cd junk; touch 1.txt 2.txt 3.c 4.h .5.txt
     $ echo *.txt
     1.txt 2.txt
     $ echo *
     1.txt 2.txt 3.c 4.h
     $ echo *.[hc]
     3.c 4.h
     $ echo .*
     . .. .5.txt
     $ echo .[^.]*
     .5.txt
     $ echo [^1-3]*
     4.h
     $ cd ..; rm -rf junk

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值