pwd显示工作目录
- [root@localhost ~]# pwd
- /root
cd 切换回家目录,注意:bash中,~表示家目录:
- [root@localhost ~]# cd
- [root@localhost ~]#
cd ~USERNAME:切换至指定用户的家目录;cd ~切换回自己的家目录; cd -:在上一次所在目录与当前目录之间来回切换;
- [root@localhost ~]# cd ~goodlove007
- [root@localhost goodlove007]#
ls 列出指定目录下的内容
- ls [OPTION]... [FILE]...
ls -a 显示所有文件,包括隐藏文件
- [root@localhost ~]# ls -a
- . .bash_logout .config .lesshst
- .. .bash_profile .cshrc original-ks.cfg
- anaconda-ks.cfg .bashrc .dbus .tcshrc
- .bash_history .cache initial-setup-ks.cfg
ls -A 显示除.和..之外的所有文件
- [root@localhost ~]# ls -A
- anaconda-ks.cfg .bash_profile .config initial-setup-ks.cfg .tcshrc
- .bash_history .bashrc .cshrc .lesshst
- .bash_logout .cache .dbus original-ks.cfg
ls -l:–long,长格式列表,即文件的详细属性信息
- [root@localhost ~]# ls -l
- total 12
- -rw-------. 1 root root 2949 Jun 15 18:39 anaconda-ks.cfg
- -rw-r--r--. 1 root root 2964 Jun 15 11:02 initial-setup-ks.cfg
- -rw-------. 1 root root 2066 Jun 15 18:39 original-ks.cfg
- -rw-------. 1 root root 2949 Jun 15 18:39 anaconda-ks.cfg
-: 文件类型,-,d,b,c,l,s,p
rw——-
rw-:文件属主的权限;
—:文件属组的权限;
—:其他用户(非属主、属组)的权限;
1:数字表示文件被硬链接的次数;
root:文件的属主;
root:文件的属组;
2949:数字表示文件的大小,单位是字节
Jun 15 18:39 :文件最后一次被修改的时间;
anaconda-ks.cfg 文件名
ls -h,–human-readable:对文件大小单位换算;换算后的结果可能会非精确值;
[root@localhost ~]# ls -lhtotal 12K-rw-------. 1 root root 2.9K Jun 15 18:39 anaconda-ks.cfg-rw-r--r--. 1 root root 2.9K Jun 15 11:02 initial-setup-ks.cfg-rw-------. 1 root root 2.1K Jun 15 18:39 original-ks.cfg
ls -d:查看目录自身而非其内部的文件列表;
[root@localhost ~]# ls -d.
ls -r:逆序显示;
[root@localhost ~]# lsanaconda-ks.cfg initial-setup-ks.cfg original-ks.cfg[root@localhost ~]# ls -roriginal-ks.cfg initial-setup-ks.cfg anaconda-ks.cfg
ls -R:递归显示;
原创文章,作者:N27_太极异次元,如若转载,请注明出处:http://www.178linux.com/78574

