三. 文件系统中跳转

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 - 从标准输入读取数据,并同时写到标准输出和文件

Linux - TLCL的更多相关文章

  1. Linux 驱动开发

    linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...

  2. Linux学习笔记——重点推荐的Linux网络在线学习资源

     首先非常感谢百度,感谢网络的搜索引擎技术,也非常感谢学习资源的贡献者和组织! 1:http://billie66.github.io/TLCL/book/zh/ 2:http://www.ha97. ...

  3. 《The Linux Command Line》 读书笔记01 基本命令介绍

    <The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...

  4. #Linux学习笔记# 自定义shell终端提示符

    我使用的Linux发行版是LinuxMint 17.2 Rafaela,默认情况下Terminal中的shell提示包括了用户名.主机名.当前目录(绝对路径)和提示符.这样会导致当进入一个比较深的目录 ...

  5. Reso | The Linux Command Line 的中文版

    http://book.haoduoshipin.com/tlcl/book/zh/ 本书是 The Linux Command Line 的中文版, 为大家提供了多种不同的阅读方式. 中英文双语版- ...

  6. Linux学习,在线版

    考虑加入Linux教派,最初被Linux吸引是看了<Unix编程艺术>,虽然里面的个别非常教条,极端.但是里面大部分的设计思想我还是认同的. 下面是我整理的一些Linux资料,其实我打算折 ...

  7. [转]Linux 基本操作(RM 删除)

    来自:http://billie66.github.io/TLCL/book/chap05.html Be Careful With rm! 小心 rm! Unix-like operating sy ...

  8. Chap1 引言[The Linux Command Line]

    附上链接:http://billie66.github.io/TLCL/book/chap01.html Content: part1-Introduction part2-Learning The ...

  9. linux入门001--帮助支持

    linux入门001--帮助支持====1. 帮助手册提供命令的使用说明:man ls提供基础知识和参考信息,有时会有实例和交叉索引,但是基本没有教程式的文档.就是说,并不会有偏重告诉你那个重要,那个 ...

随机推荐

  1. AcWing 913. 排队打水

    #include <iostream> #include <algorithm> using namespace std; typedef long long LL; ; in ...

  2. AcWing 802. 区间和 离散化

    https://www.acwing.com/problem/content/804/ #include <iostream> #include <vector> #inclu ...

  3. vue 文件插件 Vetur 设置说明官网

    vue 文件插件 Vetur 设置说明官网 https://vuejs.github.io/vetur/formatting.html#settings

  4. SpringBoot整合Mybatis案例

    SpringBoot整合Mybatis案例 2019/7/15以实习生身份入职公司前端做Angular ,但是感觉前途迷茫,于是乎学习一下Java的框架——SpringBooot. 参照大神博客:ht ...

  5. 【常识】常用RGB颜色对照表

    RGB颜色表 白色:rgb(255,255,255) 黑色:rgb(0,0,0) 红色:rgb(255,0,0) 绿色:rgb(0,255,0) 蓝色:rgb(0,0,255) 青色:rgb(0,25 ...

  6. Linux新建用户,切换后只显示$问题

    1,执行以下命令创建一个新的用户 useradd -d /home/sam -m sam -s /bin/sh -g group -G adm,root 这个命令中指定了这个用户登录的shell 是/ ...

  7. MySql 怎么存取 Emoji

    01.前言 Emoji 在我们生活中真的是越来越常见了,几乎每次发消息的时候不带个 Emoji,总觉得少了点什么,似乎干巴巴的文字已经无法承载我们丰富的感情了.对于我们开发者来说,如何将 Emoji ...

  8. [python]Python 字典(Dictionary) update()方法

    update() 函数把字典dict2的键/值对更新到dict里.如果后面的键有重复的会覆盖前面的语法dict.update(dict2) dict = {'Name': 'Zara', 'Age': ...

  9. promise学习,多看几次。含node,ES6知识

    一.引出promise解决回调地狱 需求:你要封装一个方法,我给你一个要读取文件的路径,你这个方法能帮我读取文件,并把内容返回给我 目录图片 三个txt里面的内容分别是111,222,333 1.模块 ...

  10. extern "C" 与函数重载

    前言 如果向要在一个文件中使用另一个文件中的变量,不能在头文件中定义全局变量,因为被多个文件包含后会导致编译出错,并且静态的static变量,只能在本文件内使用,这时候就可以使用extern关键字. ...