Linux学习笔记(2)
来源:互联网 发布:centos 删除 rm 编辑:程序博客网 时间:2024/05/18 02:30
Linux 常用命令
touch:
作用:改变目录或文件的时间,或创建一个新的文件
用法:
[jerry@localhost test]$ touch newfile1 newfile2[jerry@localhost test]$ lltotal 0-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:53 newfile1-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:53 newfile2
- [-r –reference]把指定的目录或文件的时间设置成和参考目录或文件的时间相同,touch -r [参考…] [指定…]
[jerry@localhost test]$ touch newfile3[jerry@localhost test]$ lltotal 0-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:53 newfile1-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:53 newfile2-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:57 newfile3[jerry@localhost test]$ touch -r newfile3 newfile1[jerry@localhost test]$ lltotal 0-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:57 newfile1-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:53 newfile2-rw-rw-r--. 1 jerry jerry 0 Oct 1 21:57 newfile3
cat:
作用:
- 一次显示整个文件,cat filename
- 从键盘创建一个文件,cat > filename
- 将多个文件合并成一个文件,cat file1 file2 > newfile
用法:
[jerry@localhost test]$ cat /etc/issue\SKernel \r on an \m[jerry@localhost test]$ cat > kbfileHello WorldLinux Enjoy ^C[jerry@localhost test]$ lskbfile newfile1 newfile2 newfile3[jerry@localhost test]$ cat kbfile Hello WorldLinuxEnjoy
tac:
作用:与cat类似,反向列示
用法:
[jerry@localhost test]$ tac kbfile EnjoyLinuxHello World
more:
作用:功能与cat类似,cat命令是将整个文件的内容从上到下显示在屏幕上,more会一页一页的显示,方便使用者逐页阅读
- 按空格键[space]:显示下一页
- 按字母键b:显示上一页
用法:
more filename
- [-n –num]每页显示n行
less:
作用:与more类似,但更具弹性,less 在查看之前不会加载整个文件
用法:
less filename
浏览文件过程中
- 按/内容,向下搜索“内容”,按字母键n翻页
- 按?内容,向上搜索“内容”,按字母键n翻页
head:
作用:显示文件的开头,默认显示前10行
用法:
head filename
- [-n –lines]:指定显示文件前n行
tail:
作用:与head类似,反向显示
用法:
tail filename
- [-n –lines]:指定显示文件末尾n行
- [-f –follow]:动态显示文件末尾内容,可以用来监视log文件
0 0
- linux学习笔记(2)
- Linux学习笔记----(2)
- linux学习笔记(2)
- linux学习笔记(2)
- Linux学习笔记(2)
- Linux学习笔记(2)
- linux学习笔记(2)
- linux学习笔记(2)
- Linux学习笔记(2)
- linux学习笔记(2)
- Linux学习笔记(2)
- linux学习笔记(2)
- linux学习笔记(2)
- Linux学习笔记(2)--Linux安装
- linux学习笔记(2)
- Linux学习笔记2
- linux学习笔记 2
- Linux学习笔记2
- nyoj 485 A*B的问题
- 在Mac下安装XAMPP+在Mac下安装Wordpress
- 编译kbengine_ogre_demo-master(三)
- hdu 5493 Queue(线段树)
- Java中的委托模式
- Linux学习笔记(2)
- Android控件:ScrollView的使用,滑动到底部的监听
- OpenGL教程翻译 第二十三课 阴影贴图(一)
- 网页常用JavaScript代码
- 关于On Error Resume Next与On Error Goto 0
- uva 10820 约束个数
- 使用层序遍历序列化和反序列化二叉树
- [Leetcode]Find Peak Element
- OpenGL教程翻译 第二十四课 阴影贴图(二)