Centos7 相关命令(一)

shutdown -c 取消关机计划

shutdown -h 5 在五分钟后关机

shutdown -r 5 五分钟后重启机器

shutdown -h/-r now/0 立即关机/重启

poweroff/reboot 立即关机/重启

cd 切换 cd /etc/sysconfig/

echo 将信息输出到屏幕中
echo hellow word > test.txt 将内容输入到test.txt文件中 会将原文件内容清空
echo hellow word >> test.txt 将内容追加到test.txt文件中 不清空原文件内容,追加内容

touch test.txt 建立空文件

mkdir test 建立空文件夹
mkdir -p test/test1/test2/test3 建立多级目录

pwd 查看当前所在目录

cat 查看文件 cat ifcfg-ens33

vim 、vi vim test.txt vi test.txt 编辑文件
:set number 文件显示行数
:n 在文本中跳转指定行n

cp cp /tmp/file/test.txt /tmp/test/ 复制文件到指定目录

cp /tmp/file/test.txt  /tmp/test/test1.txt 复制文件到指定目录,并重命名为test1.txt

cp /tmp/file/  /tmp/test/test1  复制file目录文件夹至test文件夹下 并重命名为test1

cp -rf /tmp/file/  /tmp/test/test1 强制复制

rm rm test.txt 删除文件 rm -r test 删除文件夹 r:递归 f:强制删除

 rm -f 强制删除文件 rm -rf 强制删除文件夹

猜你喜欢

转载自blog.csdn.net/qq_38855362/article/details/106279522