清空文件内容通过重定向到Null清空文件
Bash运行代码复制代码
~# > my_access.log
使用 cat/cp/dd 实用工具及 /dev/null 设备来清空文件
cat /dev/null > my_access.log
或者
cp /dev/null my_access.log
使用 true 命令重定向清空文件
~# true > my_access.log
使用echo清空文件
echo "" > my_access.log
或者
echo > my_access.lo
使用 truncate 命令来清空文件内容
truncate -s 0 my_access.log
重命名文件
mv test.txt test2.txt
cp test.txt test2.txt
使用rename命令,将有更多的控制权
批量重命名txt文件为log文件。
rename .txt .log *.txt
查询ip
ifconfig