Linux:常规目录操作
1.pwd :查看当前目录路径
[root@sunqiao ~]# pwd
/root
[root@sunqiao init]# pwd
/etc/init
2.cd 进入一个文件目录
[root@sunqiao etc]# cd /lianxi
[root@sunqiao lianxi]#
cd ~user 进入user的家目录
cd - 回到上个所在目录
cd ..进入上个目录
3. ls命令使用介绍
ls命令使用权限:所有用户
格式:ls 【选项】【目录名】
功能:列出目标目录中所有的子目录和文件
选项说明:
-a 用于显示所有文件和子目录(包括显示以.开头的隐藏文件)
-l 除了文件名外,还将显示文件的权,所有者,文件大小等详细信息列出
-h 以人类能读懂的方式显示
-i 输出文件的i节点的索引信息
[root@sunqiao ~]# ls
123.ctb Pictures Videos
anaconda-ks.cfg Public vmware
Desktop qiao vnc.sh
Documents qiao~ wukong
Downloads rpmbuild xiao
install.log sda-mbr.bak xiaoli
install.log.syslog sun xiaowang
mmt sunqiao Yozo_Officelog.txt
Music sunqiao.tar.gz yozoXpacklog.txt
ntfs-3g_ntfsprogs-2011.4.12 sun.tar.gz
ntfs-3g_ntfsprogs-2011.4.12.tgz Templates
[root@sunqiao ~]# ls -a
. .ICEauthority sun
.. .icons sunqiao
123.ctb .imsettings.log sunqiao.tar.gz
.adobe install.log sun.tar.gz
anaconda-ks.cfg install.log.syslog .swp
.bash_history .kde .tcshrc
.bash_logout .lesshst Templates
.bash_profile .lftp .themes
.bashrc .local .thumbnails
.cache .mailcap Videos
.config mmt .viminfo
.cshrc .mozilla .vimrc
.dbus Music vmware
Desktop .nautilus .vmware
.dmrc ntfs-3g_ntfsprogs-2011.4.12 .vnc
Documents ntfs-3g_ntfsprogs-2011.4.12.tgz vnc.sh
Downloads Pictures wukong
.elinks Public xiao
.esd_auth .pulse xiaoli
.gconf .pulse-cookie xiaowang
.gconfd qiao .xinputrc
.gnome2 qiao~ .xsession-errors
.gnome2_private .recently-used.xbel .xsession-errors.old
.gtk-bookmarks rpmbuild .Yozo_Office
.gvfs sda-mbr.bak Yozo_Officelog.txt
.helix .ssh .YozoWeboffice
.history .stardict yozoXpacklog.txt
[root@sunqiao ~]# ls -l
total 11116
-rw-r--r-- 1 root root 35840 Mar 29 20:08 123.ctb
-rw-------. 1 root root 1856 Mar 17 18:39 anaconda-ks.cfg
drwxr-xr-x 4 root root 4096 Apr 2 19:35 Desktop
drwxr-xr-x 5 root root 4096 Mar 18 14:36 Documents
drwxr-xr-x 5 root root 4096 Apr 1 19:31 Downloads
-rw-r--r--. 1 root root 36958 Mar 17 18:39 install.log
-rw-r--r--. 1 root root 8411 Mar 17 18:35 install.log.syslog
drwxr-xr-x 3 root root 4096 Mar 29 09:57 mmt
drwxr-xr-x 2 root root 4096 Mar 18 19:57 Music
drwxr-xr-x 8 1000 users 4096 Apr 1 19:15 ntfs-3g_ntfsprogs-2011.4.12
-rw-r--r-- 1 root root 1126704 Nov 11 11:08 ntfs-3g_ntfsprogs-2011.4.12.tgz
drwxr-xr-x 2 root root 4096 Mar 17 18:41 Pictures
drwxr-xr-x 2 root root 4096 Mar 17 18:41 Public
-rw-r--r-- 1 root root 34 Mar 26 19:03 qiao
-rw-r--r-- 1 root root 34 Mar 23 13:39 qiao~
drwxr-xr-x 8 root root 4096 Mar 17 21:51 rpmbuild
-rw-r--r-- 1 root root 512 Mar 25 21:10 sda-mbr.bak
drwxr-xr-x 2 root root 4096 Mar 30 16:46 sun
drwxr-xr-x 3 root root 4096 Mar 26 19:03 sunqiao
-rw-r--r-- 1 root root 10035375 Mar 27 18:51 sunqiao.tar.gz
-rw-r--r-- 1 root root 10240 Mar 27 18:49 sun.tar.gz
drwxr-xr-x 2 root root 4096 Mar 17 18:41 Templates
drwxr-xr-x 2 root root 4096 Mar 17 18:41 Videos
drwxr-xr-x 20 root root 4096 Apr 1 21:07 vmware
-rwxr-xr-x. 1 root root 66 Mar 17 18:39 vnc.sh
-rw-r--r-- 1 root root 0 Mar 30 16:41 wukong
-rw-r--r-- 1 root root 18 Mar 30 16:30 xiao
-rw-r--r-- 1 root root 154 Mar 30 16:40 xiaoli
-rw-r--r-- 1 root root 34 Mar 30 16:42 xiaowang
-rw-r--r-- 1 root root 11910 Mar 29 10:01 Yozo_Officelog.txt
-rw-r--r-- 1 root root 640 Mar 30 15:32 yozoXpacklog.txt
[root@sunqiao ~]# ls -i
8651688 123.ctb 8651593 sda-mbr.bak
8650761 anaconda-ks.cfg 8651508 sun
8650772 Desktop 8651250 sunqiao
8650776 Documents 8651548 sunqiao.tar.gz
8650773 Downloads 8651201 sun.tar.gz
8650754 install.log 8650774 Templates
8650755 install.log.syslog 8650779 Videos
8651291 mmt 8650923 vmware
8650777 Music 8650762 vnc.sh
8782433 ntfs-3g_ntfsprogs-2011.4.12 8651676 wukong
8651653 ntfs-3g_ntfsprogs-2011.4.12.tgz 8651672 xiao
8650778 Pictures 8651677 xiaoli
8650775 Public 8651678 xiaowang
8651589 qiao 8650908 Yozo_Officelog.txt
8651740 qiao~ 8651647 yozoXpacklog.txt
8782975 rpmbuild
[root@sunqiao ~]# ls -h
123.ctb Pictures Videos
anaconda-ks.cfg Public vmware
Desktop qiao vnc.sh
Documents qiao~ wukong
Downloads rpmbuild xiao
install.log sda-mbr.bak xiaoli
install.log.syslog sun xiaowang
mmt sunqiao Yozo_Officelog.txt
Music sunqiao.tar.gz yozoXpacklog.txt
ntfs-3g_ntfsprogs-2011.4.12 sun.tar.gz
ntfs-3g_ntfsprogs-2011.4.12.tgz Templates
[root@sunqiao ~]#
4.mkdir 用来新建目录
格式:mkdir【选项】【目录】
参数:
-m 用于对新建目录设置存取权限,也可以用chmod命令进行设置
-p 需要时创建上层文件夹(或目录),如果文件夹(或目录)已经存在,则不识为错
[root@sunqiao lianxi]# ls
yonghu.sh
[root@sunqiao lianxi]# mkdir sun
[root@sunqiao lianxi]# ls
sun yonghu.sh
[root@sunqiao lianxi]# mkdir qiao/xiaoqiao
mkdir: cannot create directory `qiao/xiaoqiao‘: No such file or directory
[root@sunqiao lianxi]# mkdir qiao/xiaoqiao -p
[root@sunqiao lianxi]# ls
qiao sun yonghu.sh
[root@sunqiao lianxi]# cd qiao
[root@sunqiao qiao]# ls
xiaoqiao
mkdir qiao/xiaoqiao -p 在工作目录建立 qiao/xiaoqiao 。建立一个名为xiaoqiao目录,当父目录qiao不在时,则自动新建qiao
5.du 用来显示目前目录所占的磁盘空间
-h 用GB,MB,KB单位计算块数
-m 用MB单位计算块数
-s 显示整个磁盘的使用情况
[root@sunqiao qiao]# du /boot
252 /boot/efi/EFI/redhat
256 /boot/efi/EFI
260 /boot/efi
16 /boot/lost+found
284 /boot/grub
27064 /boot
[root@sunqiao qiao]# du -h /b
bak/ bin/ boot/
[root@sunqiao qiao]# du -h /boot
252K /boot/efi/EFI/redhat
256K /boot/efi/EFI
260K /boot/efi
16K /boot/lost+found
284K /boot/grub
27M /boot
[root@sunqiao qiao]# du -sh /boot
27M /boot
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。