1.pwd :查看当前目录路径
[root@sunqiao ~]# pwd
/root[root@sunqiao init]# pwd/etc/init2.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 Videosanaconda-ks.cfg Public vmwareDesktop qiao vnc.shDocuments qiao~ wukongDownloads rpmbuild xiaoinstall.log sda-mbr.bak xiaoliinstall.log.syslog sun xiaowangmmt sunqiao Yozo_Officelog.txtMusic sunqiao.tar.gz yozoXpacklog.txtntfs-3g_ntfsprogs-2011.4.12 sun.tar.gzntfs-3g_ntfsprogs-2011.4.12.tgz Templates[root@sunqiao ~]# ls -a. .ICEauthority sun.. .icons sunqiao123.ctb .imsettings.log sunqiao.tar.gz.adobe install.log sun.tar.gzanaconda-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 vmwareDesktop .nautilus .vmware.dmrc ntfs-3g_ntfsprogs-2011.4.12 .vncDocuments ntfs-3g_ntfsprogs-2011.4.12.tgz vnc.shDownloads 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 -ltotal 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.cfgdrwxr-xr-x 4 root root 4096 Apr 2 19:35 Desktopdrwxr-xr-x 5 root root 4096 Mar 18 14:36 Documentsdrwxr-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.syslogdrwxr-xr-x 3 root root 4096 Mar 29 09:57 mmtdrwxr-xr-x 2 root root 4096 Mar 18 19:57 Musicdrwxr-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.tgzdrwxr-xr-x 2 root root 4096 Mar 17 18:41 Picturesdrwxr-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.bakdrwxr-xr-x 2 root root 4096 Mar 30 16:46 sundrwxr-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.gzdrwxr-xr-x 2 root root 4096 Mar 17 18:41 Templatesdrwxr-xr-x 2 root root 4096 Mar 17 18:41 Videosdrwxr-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 -i8651688 123.ctb 8651593 sda-mbr.bak8650761 anaconda-ks.cfg 8651508 sun8650772 Desktop 8651250 sunqiao8650776 Documents 8651548 sunqiao.tar.gz8650773 Downloads 8651201 sun.tar.gz8650754 install.log 8650774 Templates8650755 install.log.syslog 8650779 Videos8651291 mmt 8650923 vmware8650777 Music 8650762 vnc.sh8782433 ntfs-3g_ntfsprogs-2011.4.12 8651676 wukong8651653 ntfs-3g_ntfsprogs-2011.4.12.tgz 8651672 xiao8650778 Pictures 8651677 xiaoli8650775 Public 8651678 xiaowang8651589 qiao 8650908 Yozo_Officelog.txt8651740 qiao~ 8651647 yozoXpacklog.txt8782975 rpmbuild[root@sunqiao ~]# ls -h123.ctb Pictures Videosanaconda-ks.cfg Public vmwareDesktop qiao vnc.shDocuments qiao~ wukongDownloads rpmbuild xiaoinstall.log sda-mbr.bak xiaoliinstall.log.syslog sun xiaowangmmt sunqiao Yozo_Officelog.txtMusic sunqiao.tar.gz yozoXpacklog.txtntfs-3g_ntfsprogs-2011.4.12 sun.tar.gzntfs-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]# lssun yonghu.sh[root@sunqiao lianxi]# mkdir qiao/xiaoqiaomkdir: cannot create directory `qiao/xiaoqiao': No such file or directory[root@sunqiao lianxi]# mkdir qiao/xiaoqiao -p[root@sunqiao lianxi]# lsqiao sun yonghu.sh[root@sunqiao lianxi]# cd qiao[root@sunqiao qiao]# lsxiaoqiao mkdir qiao/xiaoqiao -p 在工作目录建立 qiao/xiaoqiao 。建立一个名为xiaoqiao目录,当父目录qiao不在时,则自动新建qiao5.du 用来显示目前目录所占的磁盘空间
-h 用GB,MB,KB单位计算块数
-m 用MB单位计算块数
-s 显示整个磁盘的使用情况
[root@sunqiao qiao]# du /boot
252 /boot/efi/EFI/redhat256 /boot/efi/EFI260 /boot/efi16 /boot/lost+found284 /boot/grub27064 /boot[root@sunqiao qiao]# du -h /bbak/ bin/ boot/ [root@sunqiao qiao]# du -h /boot252K /boot/efi/EFI/redhat256K /boot/efi/EFI260K /boot/efi16K /boot/lost+found284K /boot/grub27M /boot[root@sunqiao qiao]# du -sh /boot27M /boot