三. 文件系统中跳转

pwd - Print name of current working directory

cd - Change directory

ls - List directory contents

pwd — 打印出当前工作目录名

cd — 更改目录

ls — 列出目录内容

四. 探究操作系统

ls – List directory contents

file – Determine file type

less – View file contents

ls — 列出目录内容

file — 确定文件类型

less — 浏览文件内容

五. 操作文件和目录

cp – Copy files and directories

mv – Move/rename files and directories

mkdir – Create directories

rm – Remove files and directories

ln – Create hard and symbolic links

cp — 复制文件和目录

mv — 移动/重命名文件和目录

mkdir — 创建目录

rm — 删除文件和目录

ln — 创建硬链接和符号链接

通配符
rm 命令用到通配符(除了仔细检查输入的内容外!), 用 ls 命令来测试通配符 例如 rm * -> ls *

六. 使用命令

type – Indicate how a command name is interpreted

type – 说明怎样解释一个命令名

which – Display which executable program will be executed

which – 显示会执行哪个可执行程序

man – Display a command’s manual page

man – 显示命令手册页

apropos – Display a list of appropriate commands

apropos – 显示一系列适合的命令

info – Display a command’s info entry

info – 显示命令 info

whatis – Display a very brief description of a command

whatis – 显示一个命令的简洁描述

alias – Create an alias for a command

alias – 创建命令别名

七. 重定向

>重定向标准输出
如果要删除一个文件,有一个技巧:> a a为要被删除的文件
重定向时,目标文件总是从开头被重写。错误信息不能输出到标准输出,重定向操作开始
重写文件,然后由于错误而停止,导致文件内容删除。
>> 追加 重定向标准错误
标准输入、输出和错误,shell 内部分别将其称为文件描述符0、1和2
因为标准错误和文件描述符2一样,我们用这种 表示法来重定向标准错误
ls -al /usr/bin1 2> a 重定向标准输出和错误到同一个文件
旧版本shell:
ls -l /usr/bin > a 2>&1
ls -l /usr/bin1 > a 2>&1
首先重定向标准输出到文件 a,然后 重定向文件描述符2(标准错误)到文件描述符1(标准输出)
使用表示法2>&1
新版本shell:
ls -l /usr/bin1 &> a 重定向标准输入
cat - Concatenate files
cat < a.txt
如果就输入cat, 默认会从标准输入读取数据,又标准输入默认链接到键盘。 sort - Sort lines of text 管道线pipelines( | )
一个命令的标准输出可以通过pipelines送至另外一个命令的标准输入
例如ls -l /usr/bin | less 过滤器:把几个命令放在一起组成一个管道线
例如:把目录/bin 和/usr/bin 中 的可执行程序都联合在一起,再把它们排序,然后浏览执行结果
ls /bin /usr/bin | sort | less uniq - Report or omit repeated lines
uniq 命令经常和 sort 命令结合在一起使用
ls /bin /usr/bin | sort | uniq | less
ls /bin /usr/bin | sort | uniq -d | less grep - Print lines matching a pattern
ls /bin /usr/bin | sort | uniq | grep zip wc - Print newline, word, and byte counts for each file
ls /bin /usr/bin | sort | uniq | wc -l head - Output the first part of a file
tail - Output the last part of a file
默认情况打10行。例如-n 5 打印5行 tail -f 继续监测文件 tee - Read from standard input and write to standard output and files
tee 程序从标准输入读入数据,并且同时复制数据 到标准输出(允许数据继续随着管道线流动) 和一个或多个文件。当在某个中间处理 阶段来捕捉一个管道线的内容时,这很有帮助。
在 grep 过滤管道线的内容之前,来捕捉整个目录列表到文件 ls.txt
ls /usr/bin | tee ls.txt | grep zip cat - 连接文件 sort - 排序文本行 uniq - 报道或省略重复行 grep - 打印匹配行 wc - 打印文件中换行符,字,和字节个数 head - 输出文件第一部分 tail - 输出文件最后一部分 tee - 从标准输入读取数据,并同时写到标准输出和文件

最新文章

  1. 使用CSS3制作导航条和毛玻璃效果
  2. android开发时使用游标时一定要关闭
  3. CSS使用自定义光标样式-遁地龙卷风
  4. CGContextAddArcToPoint和CGContextAddArc
  5. Hive Experiment 2(表动态分区和IDE)
  6. android popupwindow低版本报空指针
  7. hdu1114Piggy-Bank(DP完全背包)
  8. Protobuf使用(一)
  9. 【原】storm组件(架构层面)
  10. Pytorch中torch.autograd ---backward函数的使用方法详细解析,具体例子分析
  11. [Swift]LeetCode911. 在线选举 | Online Election
  12. nginx+apache动静分离/负载均衡
  13. vue 移动端轻量日期组件不依赖第三方库
  14. js数值大小判断的错误
  15. 7B - 今年暑假不AC
  16. 小程序 official-account
  17. Linux下的启动oracle的EM的命令
  18. mysql 案例 ~ pt-io工具的使用
  19. css特效博客
  20. 字符串中包含汉字和\u,显示出汉字来

热门文章

  1. 第五十三篇 Linux相关——Web服务器
  2. Apache Kafka(四)- 使用 Java 访问 Kafka
  3. 智能指针和异常、 weak_ptr、unique_ptr
  4. testng实现代码和数据分层
  5. D. Mahmoud and Ehab and another array construction task 因子分界模板+贪心+数学
  6. ACM的探索之Everything is Generated In Equal Probability! 后序补充丫!
  7. DB技能数据库里把技能伤害调整
  8. 378. 有序矩阵中第K小的元素
  9. C# byte[]转string, string转byte[] 的四种方法
  10. MySQL 避免使用字符串类型作为标识列