1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 3-Linux基础操作-cd 文件-文件夹的创建 复制 移动 删除

3-Linux基础操作-cd 文件-文件夹的创建 复制 移动 删除

时间:2022-03-04 11:40:56

相关推荐

3-Linux基础操作-cd 文件-文件夹的创建 复制 移动 删除

cd 的使用

cd——>路径切换(文件定位路径)

绝对路径: 从/开始的路径 /home/qf/zz

相对路径: 相对于当前目录开始

[root@xingdian ~]# cd /[root@xingdian /]# lsbin dev home lib64 mnt proc run srv tmp varboot etc lib media opt root sbin sys usr使用绝对路径:[root@xingdian /]# cd /etc/sysconfig/network-scripts/[root@xingdian network-scripts]# lsifcfg-CU_5G4k ifdown-sit ifup-postifcfg-enp0s25 ifdown-Team ifup-pppifcfg-HUAWEI_Mate_20_Pro_-UD- ifdown-TeamPort ifup-routesifcfg-lo ifdown-tunnel ifup-sitifdown ifup ifup-Team使用相对路径:[root@xingdian /]# cd etc/sysconfig/network-scripts/[root@xingdian network-scripts]# cd -/cd 专用:cd ~ 返回到用户的家目录cd - 返回上次所在目录cd返回到用户的家目录cd .. 返回上一级目录[root@localhost ~]# pwd//查看当前所在的目录/root

###文件/文件夹的创建、复制、移动、删除

1.文件的创建(touch)[root@xingdian ~]# touch file1.txt[root@xingdian ~]# touch /home/file2.txt[root@xingdian ~]# touch diangge{1..10}[root@localhost ~]# touch /mnt/yun{1..10}.txttouch创建已存在的文件,只会更新文件的修改时间;2.目录/文件夹的创建(mkdir)[root@xingdian ~]# mkdir zz1[root@xingdian ~]# mkdir /home/zz2[root@xingdian ~]# mkdir -v xiege{1..10}[root@xingdian ~]# mkdir -p /home/dir8/111/22[root@xingdian ~]# mkdir -pv /hoem/dir8/111/222参数解析:-p:递归创建-v:显示创建详情3.文件/文件夹的复制(cp)[root@xingdian ~]# cp -v file1.txt /opt/ 复制文件‘file1.txt’ -> ‘/opt/file1.txt’[root@xingdian ~]# cp -rv zz1 /opt/ 复制目录/文件夹‘diange1’ -> ‘/opt/zz1’参数解析:-v:显示创建详情-r:复制目录一次性拷贝多个文件[root@localhost ~]# lsqf.txt tianyun.txt[root@localhost ~]# cp zz.txt fanhua.txt /opt/[root@localhost ~]# ls /opt/zz.txt fanhua.txt[root@localhost ~]# cp a.txt /opt/b.txt //拷贝并改名4.文件/文件夹的删除(rm)[root@xingdian ~]# rm -rf file1.txt[root@xingdian ~]# rm -rf zz1[root@xingdian ~]# rm -rf /opt/file1.txt参数解析:-r 递归-f force强制扩展:pwd:查看当前目录tab:命令自动补全5.查看文件内容(cat)[root@xingdian ~]# cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologin

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。