linux 清空文件常用方法
来源:互联网 发布:淘宝usa商城假货 编辑:程序博客网 时间:2024/06/15 03:29
转载:
http://www.cnblogs.com/mrwang1101/p/6166326.htm
1 . 使用重定向的方法
2 .使用true命令重定向清空文件
3 .使用cat/cp/dd命令及/dev/null设备来清空文件
4 . 使用echo命令清空文件
5 . 使用truncate命令清空文件
guosheng@guosheng:~/code/practice/bash_practice$ du -h test1.sh 4.0K test1.shguosheng@guosheng:~/code/practice/bash_practice$ > test1.sh guosheng@guosheng:~/code/practice/bash_practice$ du -h test1.sh 0 test1.shguosheng@guosheng:~/code/practice/bash_practice$ du -h test2.sh 4.0K test2.shguosheng@guosheng:~/code/practice/bash_practice$ true > test2.sh guosheng@guosheng:~/code/practice/bash_practice$ du -h test2.sh 0 test2.shguosheng@guosheng:~/code/practice/bash_practice$ du -h test3.sh du: 无法访问'test3.sh': 没有那个文件或目录guosheng@guosheng:~/code/practice/bash_practice$ ls3test.sh 4test.sh 5test.sh 6test.sh 7test.sh 8test.sh 9test.sh lizi_bash test1.sh test2.sh test7.shguosheng@guosheng:~/code/practice/bash_practice$ du -h 3test.sh 4.0K 3test.shguosheng@guosheng:~/code/practice/bash_practice$ cat /dev/null > 3test.sh guosheng@guosheng:~/code/practice/bash_practice$ du -h 3test.sh 0 3test.shguosheng@guosheng:~/code/practice/bash_practice$ du -h 4test.sh 4.0K 4test.shguosheng@guosheng:~/code/practice/bash_practice$ echo -n "" >4test.sh guosheng@guosheng:~/code/practice/bash_practice$ du -h 4test.sh 0 4test.shguosheng@guosheng:~/code/practice/bash_practice$ du -h 5test.sh 4.0K 5test.shguosheng@guosheng:~/code/practice/bash_practice$ truncate -s 0 5test.sh guosheng@guosheng:~/code/practice/bash_practice$ du -h 5test.sh 0 5test.shguosheng@guosheng:~/code/practice/bash_practice$
阅读全文
0 0
- linux 清空文件常用方法
- linux下清空文件的方法
- linux下清空文件内容方法
- linux 清空文件内容若干方法
- Linux中清空文件的方法
- linux清空文件
- Linux下vim基本操作和清空文件内容的常用方法
- 清空文件的方法
- 清空文件的方法
- linux 清空文件内容
- linux 清空文件内容
- linux清空文件内容
- Linux 清空文件内容
- linux 清空文件内容
- linux几种快速清空文件内容的方法
- linux几种快速清空文件内容的方法
- linux几种快速清空文件内容的方法
- Linux下几种快速清空文件内容的方法
- 跨域问题
- vptr指针
- 多台服务器日志查看
- CVE-2017-9805:Struts2 REST插件远程执行命令漏洞(S2-052) 分析报告
- Antenna Magus Professional
- linux 清空文件常用方法
- 439
- 九度 题目1443:Tr A
- C# 解决{System.Data.OleDb.OleDbException (0x80004005): 提示由于将在索引,主关键字或关系中创建重复的值,请求对表的改变没有成功
- python里取消一个未曾执行的任务
- python中文正则匹配初步使用
- Untiy3d实现Ulua热更新
- 树链剖分
- 生成二维码并直接上传到七牛上