Linux命令
来源:互联网 发布:linux 修改语言环境 编辑:程序博客网 时间:2024/04/29 18:54
cat
cat是一次性显示整个文件的内容,还可以将多个文件连接起来显示,它常与重定向符号配合使用,适用于文件内容少的情况。
cat主要有三大功能:
- 一次显示整个文件:cat filename
- 从键盘创建一个文件:cat > filename 只能创建新文件,不能编辑已有文件.
- 将几个文件合并为一个文件:cat file1 file2 > file
示例
legend0011@ubuntu:~/coding/testgcc$ lsa.out funny_cat_command.txt test.cpplegend0011@ubuntu:~/coding/testgcc$ cat -n test.cpp funny_cat_command.txt 1 #include<iostream> 2 int main() { 3 for (int i = 0; i < 10; ++i) 4 std::cout << i << std::endl; 5 return 0; 6 } 7 8 this is a test cat: 9 cat >funny_cat_command.txt 10 what happend. 11 :q 12 exit 13 q 14 EOF
注意
cat > filename 是新建一个文本文件,并向里面输入内容,按Ctrl + D 保存退出
cat >funny_cat_command.txt
tac 是 cat反着写的,所以它的功能和cat相反,tac是从最后一行到第一行连续显示在屏幕上的。
more
less
awk
推荐两篇blog:
1. http://coolshell.cn/articles/9070.html
2. http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html
sed
推荐:http://coolshell.cn/articles/9104.html
grep
#
0 0
- linux命令-- ps命令
- 【linux命令】cd命令
- linux命令:crontab命令
- Linux 命令 --- df命令
- linux命令-touch命令
- 【linux命令】tr命令
- LINUX命令:more命令
- cmd命令,linux命令
- Linux命令-tar命令
- linux命令:wc命令
- linux命令:more命令
- linux命令:gzip命令
- linux命令:du 命令
- linux命令:wc命令
- Linux命令: PS命令
- Linux命令:wc命令
- Linux命令:lsof命令
- Linux命令:rm 命令
- 读《wireshark网络分析就这么简单》
- MySQL配置文件my.cnf中文详解
- Unity3d打包android apk
- Java——同步与互斥
- redis应用实例学习介绍
- Linux命令
- 从源代码的角度聊聊java中StringBuffer、StringBuilder、String中的字符串拼接
- MySQL的btree索引和hash索引的区别
- java.lang.NoSuchMethodError: javax.persistence.Table.indexes()
- Mac下添加java环境变量
- 春游好心情
- 1 Hello, world of concurrency in C++!
- 64位还是32位
- 替换除汉字字母数字和指定的字符或特殊符号外的所有内容的正则表达式