pwd:
显示当前目录
[root@leitingyan opt]# pwd
/opt
cd
切换目录
1.cd /路径
[root@leitingyan opt]# cd /usr
[root@leitingyan usr]# pwd
/usr
2.特殊符号
(1)回到当前用户的家目录
[root@leitingyan ~]# cd ~
[root@leitingyan ~]#
(2)- :回到上个目录
[root@leitingyan ~]# cd Public/
[root@leitingyan Public]# pwd
/root/Public
[root@leitingyan Public]# cd -
/root
[root@leitingyan ~]#
(3) /:回到磁盘根目录
[root@leitingyan ~]# cd /
[root@leitingyan /]#
ls:
list的意思,列出的意思,列出当前目前下的文件和文件夹
[root@leitingyan /]# ls
bin dev home lib64 media mnt opt root selinux sys usr
boot etc lib lost+found misc net proc sbin srv tmp var
(1)ls -a:表示列出当前目录下的文件和文件夹以及影藏文件
[root@leitingyan /]# ls -s
total 98
4 bin 0 dev 4 home 12 lib64 4 media 4 mnt 4 opt 4 root 0 selinux 0 sys 4 usr
2 boot 12 etc 4 lib 16 lost+found 0 misc 0 net 0 proc 12 sbin 4 srv 4 tmp 4 var
[root@leitingyan /]#
(2) ls -l:以长格式显示文件详细信息
[root@leitingyan /]# ls -l
total 98
dr-xr-xr-x. 2 root root 4096 Oct 13 04:53 bin
dr-xr-xr-x. 5 root root 1024 Oct 12 23:56 boot
drwxr-xr-x. 19 root root 3780 Oct 13 01:27 dev
drwxr-xr-x. 116 root root 12288 Oct 13 07:16 etc
drwxr-xr-x. 2 root root 4096 Jun 28 2011 home
dr-xr-xr-x. 11 root root 4096 Oct 12 23:43 lib
dr-xr-xr-x. 9 root root 12288 Oct 13 04:53 lib64
drwx------. 2 root root 16384 Oct 12 23:27 lost+found
drwxr-xr-x. 2 root root 4096 Jun 28 2011 media
drwxr-xr-x. 2 root root 0 Oct 13 01:27 misc
drwxr-xr-x. 2 root root 4096 Jun 28 2011 mnt
drwxr-xr-x. 2 root root 0 Oct 13 01:27 net
drwxr-xr-x. 3 root root 4096 Oct 12 23:49 opt
dr-xr-xr-x. 160 root root 0 Oct 13 01:26 proc
dr-xr-x---. 28 root root 4096 Oct 13 08:03 root
dr-xr-xr-x. 2 root root 12288 Oct 13 04:53 sbin
drwxr-xr-x. 7 root root 0 Oct 13 01:27 selinux
drwxr-xr-x. 2 root root 4096 Jun 28 2011 srv
drwxr-xr-x. 13 root root 0 Oct 13 01:26 sys
drwxrwxrwt. 11 root root 4096 Oct 13 05:08 tmp
drwxr-xr-x. 13 root root 4096 Oct 12 23:31 usr
drwxr-xr-x. 22 root root 4096 Oct 12 23:48 var
[root@leitingyan /]#
(3)ls -ll:命令的缩写
[root@leitingyan /]# ls -ll
total 98
dr-xr-xr-x. 2 root root 4096 Oct 13 04:53 bin
dr-xr-xr-x. 5 root root 1024 Oct 12 23:56 boot
drwxr-xr-x. 19 root root 3780 Oct 13 01:27 dev
drwxr-xr-x. 116 root root 12288 Oct 13 07:16 etc
drwxr-xr-x. 2 root root 4096 Jun 28 2011 home
dr-xr-xr-x. 11 root root 4096 Oct 12 23:43 lib
dr-xr-xr-x. 9 root root 12288 Oct 13 04:53 lib64
drwx------. 2 root root 16384 Oct 12 23:27 lost+found
drwxr-xr-x. 2 root root 4096 Jun 28 2011 media
drwxr-xr-x. 2 root root 0 Oct 13 01:27 misc
drwxr-xr-x. 2 root root 4096 Jun 28 2011 mnt
drwxr-xr-x. 2 root root 0 Oct 13 01:27 net
drwxr-xr-x. 3 root root 4096 Oct 12 23:49 opt
dr-xr-xr-x. 160 root root 0 Oct 13 01:26 proc
dr-xr-x---. 28 root root 4096 Oct 13 08:03 root
dr-xr-xr-x. 2 root root 12288 Oct 13 04:53 sbin
drwxr-xr-x. 7 root root 0 Oct 13 01:27 selinux
drwxr-xr-x. 2 root root 4096 Jun 28 2011 srv
drwxr-xr-x. 13 root root 0 Oct 13 01:26 sys
drwxrwxrwt. 11 root root 4096 Oct 13 05:08 tmp
drwxr-xr-x. 13 root root 4096 Oct 12 23:31 usr
drwxr-xr-x. 22 root root 4096 Oct 12 23:48 var
[root@leitingyan /]#
(4) ls /etc:列出/etc目录下所有文件或者文件夹
[root@leitingyan /]# ls /etc
abrt dracut.conf.d kdump.conf passwd- samba
acpi drirc krb5.conf pbm2ppa.conf sane.d
adjtime enscript.cfg latrace.conf pcmcia sasl2
aliases environment latrace.d pinforc scl
aliases.db ethers ld.so.cache pkcs11 securetty
alsa event.d ld.so.conf pki security
alternatives exports ld.so.conf.d plymouth selinux
anacrontab favicon.png libaudit.conf pm services
anthy-conf festival libreport pm-utils-hd-apm-restore.conf sestatus.conf
asound.conf filesystems libuser.conf pnm2ppa.conf setuptool.d
at.deny fonts localtime polkit-1 sgml
audisp foomatic login.defs popt.d shadow
audit fprintd.conf logrotate.conf portreserve shadow-
autofs_ldap_auth.conf fstab logrotate.d postfix shells
auto.master gai.conf lsb-release ppp skel
auto.misc gconf lsb-release.d prelink.cache smartd.conf
auto.net gcrypt ltrace.conf prelink.conf snmp
auto.smb gdm lvm prelink.conf.d sos.conf
avahi ghostscript magic printcap sound
bash_completion.d gnome-vfs-2.0 mailcap profile ssh
bashrc gnupg mail.rc profile.d ssl
blkid group makedev.d protocols sssd
bluetooth group- man.config pulse statetab
bonobo-activation grub.conf maven quotagrpadmins statetab.d
cas.conf gshadow mime.types quotatab sudo.conf
certmonger gshadow- mke2fs.conf rc sudoers
chkconfig.d gssapi_mech.conf modprobe.d rc0.d sudoers.d
ConsoleKit gtk-2.0 motd rc1.d sudo-ldap.conf
cron.d hal mtab rc2.d sysconfig
cron.daily host.conf mtools.conf rc3.d sysctl.conf
cron.deny hosts my.cnf rc4.d system-release
cron.hourly hosts.allow nanorc rc5.d system-release-cpe
cron.monthly hosts.deny netconfig rc6.d terminfo
crontab hp NetworkManager rc.d Trolltech.conf
cron.weekly httpd networks rc.local udev
crypttab idmapd.conf nfsmount.conf rc.sysinit updatedb.conf
csh.cshrc init nsswitch.conf readahead.conf vimrc
csh.login init.d ntp redhat-lsb virc
cups inittab ntp.conf redhat-release warnquota.conf
dbus-1 inputrc obex-data-server request-key.conf wgetrc
default ipa oddjob request-key.d wpa_supplicant
depmod.d iproute2 oddjobd.conf resolv.conf X11
dhcp issue oddjobd.conf.d rhsm xdg
DIR_COLORS issue.net openldap rpc xinetd.d
DIR_COLORS.256color java opt rpm xml
DIR_COLORS.lightbgcolor jvm PackageKit rsyslog.conf yp.conf
dnsmasq.conf jvm-commmon pam.d rsyslog.d yum
dnsmasq.d kde pango rwtab yum.conf
dracut.conf kdump-adv-conf passwd rwtab.d yum.repos.d
[root@leitingyan /]#
mkdir:
创建文件夹
[root@leitingyan /]# mkdir leitingyan
运行结果:
rmdir:
删除文件夹:只能删除内容为空的文件夹
[root@leitingyan /]# rmdir lty