Linux - TLCL
三. 文件系统中跳转
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的更多相关文章
- Linux 驱动开发
linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...
- Linux学习笔记——重点推荐的Linux网络在线学习资源
首先非常感谢百度,感谢网络的搜索引擎技术,也非常感谢学习资源的贡献者和组织! 1:http://billie66.github.io/TLCL/book/zh/ 2:http://www.ha97. ...
- 《The Linux Command Line》 读书笔记01 基本命令介绍
<The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...
- #Linux学习笔记# 自定义shell终端提示符
我使用的Linux发行版是LinuxMint 17.2 Rafaela,默认情况下Terminal中的shell提示包括了用户名.主机名.当前目录(绝对路径)和提示符.这样会导致当进入一个比较深的目录 ...
- Reso | The Linux Command Line 的中文版
http://book.haoduoshipin.com/tlcl/book/zh/ 本书是 The Linux Command Line 的中文版, 为大家提供了多种不同的阅读方式. 中英文双语版- ...
- Linux学习,在线版
考虑加入Linux教派,最初被Linux吸引是看了<Unix编程艺术>,虽然里面的个别非常教条,极端.但是里面大部分的设计思想我还是认同的. 下面是我整理的一些Linux资料,其实我打算折 ...
- [转]Linux 基本操作(RM 删除)
来自:http://billie66.github.io/TLCL/book/chap05.html Be Careful With rm! 小心 rm! Unix-like operating sy ...
- Chap1 引言[The Linux Command Line]
附上链接:http://billie66.github.io/TLCL/book/chap01.html Content: part1-Introduction part2-Learning The ...
- linux入门001--帮助支持
linux入门001--帮助支持====1. 帮助手册提供命令的使用说明:man ls提供基础知识和参考信息,有时会有实例和交叉索引,但是基本没有教程式的文档.就是说,并不会有偏重告诉你那个重要,那个 ...
随机推荐
- centOS7中启动MySQL数据库提示: Failed to start mysqld.service: Unit not foundc
现象: 在centOS7中启动MySQL数据库提示: Failed to start mysqld.service: Unit not found [明明已经安装了,为什么提示不存在呢?] 原因: 在 ...
- spring(二):体系结构&核心模块
Spring框架 帮助管理对象及其依赖关系 提供如通用日志记录.性能统计.安全控制.异常处理等面向切面的能力 帮助管理数据库事务,提供了一套简单的JDBC访问实现,提供与第三方数据访问框架集成(如Hi ...
- ignoreContentAdaptWithSize
使用cocosStudio 中 的Text控件时,要设定text.ignoreContentAdaptWithSize(true); 设定控件(0.5,0.5)锚点位置不随文本长度变化而变化.
- Dockers的安装
添加yum源 #下载163的yum源到本地 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7 ...
- 好文章推荐 数据库mysql
https://blog.csdn.net/guofeng93/article/details/53994112
- LED Decorative Light Supplier - Decorative Use Of LED Light Strips
Led strip refers to the led assembly in the ribbon of the FPC (flexible circuit board) or PCB hard b ...
- Docker on startup: “No activity detected on VM, aborting”
windows下安装的docker,切换到linux,一直处于重启中,最后报No activity detected on VM, aborting错误 上网百度一下这个错误,基本上没人遇到过,最后在 ...
- linux 网卡限速
#安装git yum -y install git #下载wondershaper git clone https://github.com/magnific0/wondershaper.git 第 ...
- go使用错误概览
1. 解决:GO语言中要提供给外面访问的方法或是结构体必须是首字母大写.这个结构体只有结构体名大写了,而里面的字段没有首字母大写,而GO语言在模板调用时应该认为是两个不同的过程,所以找不到值.于是把结 ...
- 使用pyaudio播放无损音乐(wav)
安装pyaudio sudo apt-get install python-pyaudio python3-pyaudio pip3 install pyaudio 执行第二步可能会遇到如下错误: 根 ...