Linux学习笔记(1)

来源:互联网 发布:win10不能在mac用了 编辑:程序博客网 时间:2024/05/19 01:10

一、命令基本格式

[root@localhost ~]# 

其中:

root代表当前登录用户

localhost主机名

~当前所在目录(家目录)

#超级用户的提示符

普通用户的提示符是$

格式为:

命令 [选项] [参数]

注意:个别命令使用不遵循此格式

    当有多个选项时,可以写在一起

    简化选项与完整选项

-a 等于 --all

二、查询目录中内容:ls

ls [选项] [文件或目录]
运行效果:
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog

选项:
-a显示所有文件,包括隐藏文件
运行效果:
[root@localhost ~]# ls -a
.   anaconda-ks.cfg  .bash_logout   .bashrc  install.log         .tcshrc
..  .bash_history    .bash_profile  .cshrc   install.log.syslog
前面带"."的表示隐藏文件

-l显示详细信息
运行效果:
[root@localhost ~]# ls -l
总用量 44
-rw-------. 1 root root  1208 12月 27 05:48 anaconda-ks.cfg
-rw-r--r--. 1 root root 25906 12月 27 05:48 install.log
-rw-r--r--. 1 root root  7690 12月 27 05:44 install.log.syslog
关于-rw-r--r--说明:
-代表文件类型(总共七种常见的有三种:- 文件,d 目录,l 软链接文件)
rw-r-- r--
u所有者 g所属组 o其他人
r读 w写 x执行
"."代表ACL权限(Centos6之后出现的) "1"表示引用计数

-d查看目录属性
运行效果:
[root@localhost ~]# ls -ld /etc/
drwxr-xr-x. 104 root root 12288 1月   6 21:17 /etc/

-h人性化显示文件大小
人性化显示:
[root@localhost ~]# ls -lh
总用量 44K
-rw-------. 1 root root 1.2K 12月 27 05:48 anaconda-ks.cfg
-rw-r--r--. 1 root root  26K 12月 27 05:48 install.log
-rw-r--r--. 1 root root 7.6K 12月 27 05:44 install.log.syslog
-i显示inode
运行效果:
[root@localhost ~]# ls -i
262419 anaconda-ks.cfg  262147 install.log  262148 install.log.syslog

0 0