Linux目录命令
来源:互联网 发布:数据抓包工具 编辑:程序博客网 时间:2024/06/05 23:47
ls [选项] [文件目录]-a 列出所有包括隐藏文件-l 显示详细信息-d 目录详细属性(查看目录信息而不是目录下的文件)-h 人性化显示文件大小-i 显示iNode
ls-l(别名ll)[root@MiWiFi-R1CM ~]# ls -l总用量 44-rw-------. 1 root root 1208 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 25906 3月 10 18:40 install.log-rw-r--r--. 1 root root 7690 3月 10 18:39 install.log.syslog
第一位为:"-"代表是普通文件
“d”代表是一个目录
“l”软连接(快捷方式)
还有四种不常用文件:块设备文件,字符设备文件,套接字文件,管道文件
--------------------------------------
每三位字符一组:
第一组权限(也就是rw):是文件所有者 的权限
第二组:所属组
第三组:其他人
除了rw权限还有x权限:执行
-----------------------------------
“1”代表引用计数
-------------------------
第一个root代表文件所有者
----------------------
第二个root位置代表文件所有者所属的用户组
------------------------
数字代表文件大小 加上-h可以显示为常用格式
ls -lh总用量 44K-rw-------. 1 root root 1.2K 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 26K 3月 10 18:40 install.log-rw-r--r--. 1 root root 7.6K 3月 10 18:39 install.log.syslog------------------
文件名以“.”开头的是隐藏文件。
------------------------
下面查看指定目录:
[root@MiWiFi-R1CM ~]# ls -l /etc/总用量 1756drwxr-xr-x. 3 root root 4096 3月 10 18:36 abrtdrwxr-xr-x. 4 root root 4096 3月 10 18:39 acpi-rw-r--r--. 1 root root 16 3月 10 18:40 adjtime-rw-r--r--. 1 root root 1512 1月 12 2010 aliases-rw-r--r--. 1 root root 12288 3月 10 18:41 aliases.dbdrwxr-xr-x. 2 root root 4096 3月 10 18:39 alsadrwxr-xr-x. 2 root root 4096 3月 10 18:39 alternatives-rw-r--r--. 1 root root 541 7月 19 2011 anacrontab-rw-r--r--. 1 root root 148 5月 15 2009 asound.conf-rw-r--r--. 1 root root 1 1月 30 2012 at.denydrwxr-x---. 3 root root 4096 3月 10 18:39 audispdrwxr-x---. 2 root root 4096 3月 10 18:39 audit-rw-------. 1 root root 232 6月 22 2012 autofs_ldap_auth.conf-rw-r--r--. 1 root root 658 6月 22 2012 auto.master-rw-r--r--. 1 root root 524 6月 22 2012 auto.misc-rwxr-xr-x. 1 root root 1260 6月 22 2012 auto.net-rwxr-xr-x. 1 root root 687 6月 22 2012 auto.smbdrwxr-xr-x. 4 root root 4096 3月 10 18:37 avahidrwxr-xr-x. 2 root root 4096 3月 10 18:39 bash_completion.d-rw-r--r--. 1 root root 2681 6月 22 2012 bashrc............------------------------------------------------
<hr>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.创建目录(make directories)
总用量的意思是:占用了多少kb
mkdir -p [目录名] -p:递归创建(一次创建多级目录用)
[root@MiWiFi-R1CM ~]# mkdir jiangshang[root@MiWiFi-R1CM ~]# ls -l总用量 48-rw-------. 1 root root 1208 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 25906 3月 10 18:40 install.log-rw-r--r--. 1 root root 7690 3月 10 18:39 install.log.syslogdrwxr-xr-x. 2 root root 4096 3月 11 00:04 jiangshang
[root@MiWiFi-R1CM ~]# mkdir -p luanzhong/aoming/jiangshang[root@MiWiFi-R1CM ~]# ls -l总用量 52-rw-------. 1 root root 1208 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 25906 3月 10 18:40 install.log-rw-r--r--. 1 root root 7690 3月 10 18:39 install.log.syslogdrwxr-xr-x. 2 root root 4096 3月 11 00:04 jiangshangdrwxr-xr-x. 3 root root 4096 3月 11 00:05 luanzhong
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.切换目录(change directories)
cd [目录] [-|.|..|~]-:上次目录.:当前..:上级~:家cd:同上
注:pwd可查看当前路径(print workspace directories)
相对路径是从当前目录为起点,绝对路径是/root为起点,不要以为是输个文件名能自动查找。
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4、删除空白目录和强制删除目录(remove empty directories)
rmdir [目录名]
rm -rf[文件和目录]-r 删除目录(注:如果该目录下有文件无法删除)-f 强制(可以删除所有的,谨慎操作)---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5、复制命令(copy)
cp [选项] [原文件或者目录] [目标目录]-r 复制目录-p 连带文件属性复制-d 若是链接文件,则复制链接文件属性-a 相当 -pdr
改名复制示例,一定不要在复制文件的时候写上不存在的文件夹,那叫改名:
[root@MiWiFi-R1CM ~]# mkdir jiangshang[root@MiWiFi-R1CM ~]# lsanaconda-ks.cfg install.log install.log.syslog jiangshang[root@MiWiFi-R1CM ~]# cp -p install.log jiangshang/copyinstall.log[root@MiWiFi-R1CM ~]# lsanaconda-ks.cfg install.log install.log.syslog jiangshang[root@MiWiFi-R1CM ~]# cd jiangshang[root@MiWiFi-R1CM jiangshang]# lscopyinstall.log-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6.剪切(move)
mv [原文件或者目录名] [目标目录]改名示例:
[root@MiWiFi-R1CM ~]# ll总用量 48-rw-------. 1 root root 1208 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 25906 3月 10 18:40 install.log-rw-r--r--. 1 root root 7690 3月 10 18:39 install.log.syslogdrwxr-xr-x. 3 root root 4096 3月 11 01:07 jiangshang[root@MiWiFi-R1CM ~]# mv jiangshang jiangshang_name[root@MiWiFi-R1CM ~]# ll总用量 48-rw-------. 1 root root 1208 3月 10 18:40 anaconda-ks.cfg-rw-r--r--. 1 root root 25906 3月 10 18:40 install.log-rw-r--r--. 1 root root 7690 3月 10 18:39 install.log.syslogdrwxr-xr-x. 3 root root 4096 3月 11 01:07 jiangshang_name[root@MiWiFi-R1CM ~]#
- linux命令 删除目录
- 【linux基础】 目录命令
- linux目录操作命令
- linux命令目录
- Linux 目录命令全称
- linux创建目录命令
- Linux目录文件命令
- linux目录处理命令
- linux文件目录命令
- Linux目录操作命令
- Linux创建目录【命令】
- linux目录管理命令
- Linux命令大全目录
- linux命令目录
- Linux命令(2):目录
- Linux目录处理命令
- Linux命令学习目录
- linux 命令学习 目录
- 蓝桥杯-算法训练 数字三角形
- 作业
- AlgorithmExample7
- mysqli和mysql以及fetch_row和fetch_array的区别
- Android提交library(aar)到JCenter和MavenCentral经验总结
- Linux目录命令
- 关于分库分表的实现
- jquery中的动画和事件
- 【BZOJ2149】拆迁队,分治+斜率优化DP
- <HDU 1722>Cake
- Myeclipse搞定源码
- 是不是该想想智能时代的用户体验怎么做了?
- 多表单提交
- 百度编辑器取消高度自动拉长