Linux命令行使用技巧及系统下文件管理(二)
3.关于文件寻址的命令
pwd 显示当前的工作目录
[westos@westos_student73 Desktop]$cd ##切换当前的工作目录 [westos@westos_student73 Desktop]$cd - ##返回当前目录之前所在的目录 [westos@westos_student73 Desktop]$cd ~- ##返回当前目录之前所在的目录,效果与"cd -"相同 [westos@westos_student73 Desktop]$cd - ## -只是cd命令的用法,~-返回之前工作目录是通用的
[westos@westos_student73 Desktop]$.. ##".."当前目录的上级目录 [westos@westos_student73 Desktop]$~ ##默认代表当前用户家目录 [westos@westos_student73 Desktop]$~username ##指定的用户家目录 [westos@westos_student73 Desktop]$"~+" = "." ##当前目录 [westos@westos_student73 Desktop]$~- ##当前目录之前所在目录 [westos@westos_student73 Desktop]$.. ##当前目录的上级目录
ls 显示文件信息
[westos@westos_student73 Desktop]$ls ##显示当前目录中子目录和子文件的名称 [westos@westos_student73 Desktop]$ls file ##显示指定文件的名称 [westos@westos_student73 Desktop]$ls dir ##显示指定目录中内容的名称 [westos@westos_student73 Desktop]$ls -d dir ##显示目录,本身的名称 [westos@westos_student73 Desktop]$ls -l file ##显示文件属性 [westos@westos_student73 Desktop]$ls -l dir ##显示目录中内容的属性 [westos@westos_student73 Desktop]$ls -ld dir ##显示目录本身属性 [westos@westos_student73 Desktop]$ls -a dir ##显示目录中所有文件名称包括隐藏文件名 [westos@westos_student73 Desktop]$ls -s ##显示文件大小 [westos@westos_student73 Desktop]$ls -R dir ##递归显示目录中的内容
4.文件批处理
| 命令 | 功能 |
|---|---|
| * | ##匹配0~任意字符 |
| ? | ##匹配单个字符 |
| [[:alpha:]] | 匹配单个字母 |
| [[:lower:]] | 匹配单个小写字母 |
| [[:upper:]] | 匹配单个大写字母 |
| [[:alpha:]] | 匹配单个字母 |
| [[:alpha:]] | 匹配单个字母 |
| [[:digit:]] | 匹配单个数字 |
| [[:alnum:]] | 匹配单个数字或字母 |
| [[:punct:]] | 匹配单个符号,比如@ #等等 |
| [[:space:]] | 匹配单个空格 |
字符集合表示方法
[] 条件是或关系是,是模糊匹配,对象和几个对比匹配就操作几个
[1-10] 1-10
[!d-f] 或[^d-f] 除了d-f以外
{} 点名机制,精确指定到指定集合中的每一个元素
{1…10} 1-10 {a…c} a-c
一次创建多个文件时要用点名机制,不能用模糊匹配



