文件管理命令
241字小于1分钟
2025-05-28
查看当前文件
ls
查看当前文件夹文件
ls -a
:查看文件,包括隐藏文件
创建文件夹
mkdir
创建文件夹
mkdir he
mkdir -p
创建多级文件夹
mkdir -p he/linux
删除文件夹
删除空文件夹
rmdir he
删除非空文件夹
rm -rf he
创建文件
touch
创建文件命令
touch hello.txt
复制命令
cp
复制文件,将 hello.txt
复制到 opt
目录下
cp hello.txt /opt
cp -r
复制文件夹
cp -r he /opt
\cp -r
复制文件夹,默认覆盖已存在的文件,不显示提示信息
\cp -r he /opt
移动文件命令
mv
命令可以对一个文件或者文件夹进行从命名,也可以移动文件或者文件夹到别的地方
重命名
mv hello.txt he.txt
将hello.txt
文件重命名为he.txt
移动文件
mv he /opt
将he文件夹移动到opt文件夹下