一、 系统目录结构
ls / 查看根目录的文件及目录
/bin、/sbin 、/usr/sbin、/usr/bin: 可执行命令存放目录
/boot: 启动相关,grub的配置文件都放在此目录
/dev: 设备文件
/etc: 系统配置文件
/home: 用户家目录
/root: root用户家目录
/lib、lib64: 系统库文件
/media: 光盘、u盘临时挂载
/mnt: 临时挂载目录
/opt: 可挂载
/proc: 进程相关
/run: 进程PID存储
/srv: 服务产生的文件
/sys:系统内核相关的文件
/tmp: 临时可写的目录
/usr 用户所用目录
/var: 动态日志存储目录 /var/log/日志存放目录
tree命令
man帮助文档
二、ls命令
ls 列出文件或目录
三、文件类型
- 普通文件
d 目录
c 字符设备
l 链接文件
b 块设备 (磁盘)
s 套接字文件
四、alias命令
alias 查看系统设置的别名
echo $PATH 查看环境变量
自定义别名
一、 系统目录结构
ls / 查看根目录的文件及目录
[root@VM_46_188_centos ~]# ls -l /total 76-rw-r--r-- 1 root root 0 Jul 21 11:27 2017-07-21.sql drwxr-xr-x 6 root root 4096 Jun 30 16:20 backup lrwxrwxrwx. 1 root root 7 Apr 21 2016 bin -> usr/bin dr-xr-xr-x. 4 root root 4096 May 10 22:37 boot drwxr-xr-x 5 root root 4096 Jul 23 17:46 data drwxr-xr-x 18 root root 2860 Jul 26 17:08 dev drwxr-xr-x. 95 root root 12288 Jul 26 17:16 etc drwxr-xr-x. 12 root root 4096 Jul 9 21:37 home lrwxrwxrwx. 1 root root 7 Apr 21 2016 lib -> usr/lib lrwxrwxrwx. 1 root root 9 Apr 21 2016 lib64 -> usr/lib64 drwx------. 2 root root 16384 Apr 21 2016 lost+found drwxr-xr-x. 2 root root 4096 Aug 12 2015 media drwxr-xr-x. 2 root root 4096 Aug 12 2015 mnt drwxr-xr-x. 3 root root 4096 Apr 21 2016 opt dr-xr-xr-x 109 root root 0 Jul 26 17:07 proc dr-xr-x---. 9 root root 4096 Aug 4 21:49 root drwxr-xr-x 23 root root 760 Jul 26 17:08 run lrwxrwxrwx. 1 root root 8 Apr 21 2016 sbin -> usr/sbin drwxr-xr-x. 2 root root 4096 Aug 12 2015 srv dr-xr-xr-x 13 root root 0 Jul 26 17:07 sys drwxrwxrwt. 7 root root 4096 Aug 5 03:22 tmp drwxr-xr-x. 13 root root 4096 Apr 21 2016 usr drwxr-xr-x. 20 root root 4096 Jul 26 17:07 var [root@VM_46_188_centos ~]#
/bin、/sbin 、/usr/sbin、/usr/bin: 可执行命令存放目录
/boot: 启动相关,grub的配置文件都放在此目录
[root@VM_46_188_centos ~]# ls /bootSystem.map-3.10.0-327.36.3.el7.x86_64 initramfs-0-rescue-f9d400c5e1e8c3a8209e990d887d4ac1.img symvers-3.10.0-327.36.3.el7.x86_64.gz System.map-3.10.0-327.el7.x86_64 initramfs-3.10.0-327.36.3.el7.x86_64.img symvers-3.10.0-327.el7.x86_64.gz config-3.10.0-327.36.3.el7.x86_64 initramfs-3.10.0-327.36.3.el7.x86_64kdump.img vmlinuz-0-rescue-f9d400c5e1e8c3a8209e990d887d4ac1 config-3.10.0-327.el7.x86_64 initramfs-3.10.0-327.el7.x86_64.img vmlinuz-3.10.0-327.36.3.el7.x86_64 grub initramfs-3.10.0-327.el7.x86_64kdump.img vmlinuz-3.10.0-327.el7.x86_64 grub2 initrd-plymouth.img [root@VM_46_188_centos ~]#
/dev: 设备文件
[root@VM_46_188_centos ~]# ls /devautofs cpu_dma_latency hpet mcelog oldmem rtc0 tty0 tty16 tty23 tty30 tty38 tty45 tty52 tty6 ttyS0 usbmon1 vcsa vda1 block crash hugepages mem port shm tty1 tty17 tty24 tty31 tty39 tty46 tty53 tty60 ttyS1 vcs vcsa1 vfio btrfs-control disk initctl mqueue ppp snapshot tty10 tty18 tty25 tty32 tty4 tty47 tty54 tty61 ttyS2 vcs1 vcsa2 vga_arbiter bus dri input net ptmx snd tty11 tty19 tty26 tty33 tty40 tty48 tty55 tty62 ttyS3 vcs2 vcsa3 vhost-net char fb0 kmsg network_latency pts stderr tty12 tty2 tty27 tty34 tty41 tty49 tty56 tty63 uhid vcs3 vcsa4 zero console fd log network_throughput random stdin tty13 tty20 tty28 tty35 tty42 tty5 tty57 tty7 uinput vcs4 vcsa5 core full loop-control null raw stdout tty14 tty21 tty29 tty36 tty43 tty50 tty58 tty8 urandom vcs5 vcsa6 cpu fuse mapper nvram rtc tty tty15 tty22 tty3 tty37 tty44 tty51 tty59 tty9 usbmon0 vcs6 vda [root@VM_46_188_centos ~]#
/etc: 系统配置文件
[root@VM_46_188_centos ~]# ls /etc DIR_COLORS chkconfig.d exports init.d magic passwd rc2.d shadow- trusted-key.key DIR_COLORS.256color chrony.conf favicon.png inittab mail passwd- rc3.d shells tuned DIR_COLORS.lightbgcolor chrony.keys filesystems inputrc mail.rc php-tcpdf rc4.d skel udev GREP_COLORS cifs-utils firewalld iproute2 mailcap php.d rc5.d smi.conf updatedb.confGeoIP.conf cron.d fonts issue makedumpfile.conf.sample php.ini rc6.d smrsh usb_modeswitch.confGeoIP.conf.default cron.daily fstab issue.net man_db.conf phpMyAdmin rdma snmp usb_modeswitch.dNetworkManager cron.deny gcrypt kdump.conf mime.types pkcs11 redhat-release sos.conf uuid Trolltech.conf cron.hourly gdbinit kernel mke2fs.conf pki resolv.conf ssh vconsole.confX11 cron.monthly gdbinit.d krb5.conf modprobe.d plymouth rpc ssl vimrc acpi cron.weekly gnupg krb5.conf.d modules-load.d pm rpm statetab virc adjtime crontab groff ld.so.cache motd polkit-1 rsyncd.conf statetab.d wgetrc aliases crypttab group ld.so.conf mtab popt.d rsyslog.conf sudo-ldap.conf wpa_supplicant aliases.db csh.cshrc group- ld.so.conf.d my.cnf postfix rsyslog.d sudo.conf xdg alternatives csh.login grub.d libaudit.conf my.cnf.d ppp rwtab sudoers xinetd.danacrontab dbus-1 grub2.cfg libnl nanorc prelink.conf.d rwtab.d sudoers.d yum asound.conf default gshadow libreport networks printcap sasl2 sysconfig yum.confat.deny depmod.d gshadow- libuser.conf nginx profile scl sysctl.conf yum.repos.daudisp dhcp gss locale.conf nsswitch.conf profile.d screenrc sysctl.conf.first audit dnsmasq.conf host.conf localtime nsswitch.conf.bak protocols securetty sysctl.davahi dnsmasq.d hostname login.defs ntp python security system-release bash_completion.d dracut.conf hosts logrotate.conf ntp.conf qcloudzone selinux system-release-cpe bashrc dracut.conf.d hosts.allow logrotate.d openldap rc.d services systemd binfmt.d e2fsck.conf hosts.deny lsm opt rc.local sestatus.conf tcsd.confcentos-release environment httpd lvm os-release rc0.d setuptool.d terminfo centos-release-upstream ethertypes img_version machine-id pam.d rc1.d shadow tmpfiles.d[root@VM_46_188_centos ~]#
/home: 用户家目录
[root@VM_46_188_centos ~]# ls /homefxq user01 user02 user03 user04 user05 user06 user07 user08 user09 [root@VM_46_188_centos ~]#
/root: root用户家目录
[root@VM_46_188_centos ~]# ls /root#fxq.txt 1.cap 1.log.tar.gz 1.txt 123.zip 3.txt a.out dir-2017-05-12 httpd_process_check.sh ping_host_alive.sh wordpress-4.7.4-zh_CN.zip, 1.ipt 1.log.tar1.xz 111.txt 2 4.txt anaconda-ks.cfg ffff ip.txt sed.txt youjian.sh ,.pub 1.log.tar 1.log.xz 12 2.cap [1-3].log auto_install_lamp.sh gdlogo.png iptables.rules shell ~iptables_rules1 1.log.tar.bz2 1.log.zip 123 2.txt \fxq.txt baidu.png gdlogo.png.1 null weixin [root@VM_46_188_centos ~]#
/lib、lib64: 系统库文件
[root@VM_46_188_centos ~]# ls /lib audit libBrokenLocale-2.17.so libffi.so.6 liblzma.so.5 libnss_nis-2.17.so libresolv.a modprobe.d binfmt.d libBrokenLocale.a libffi.so.6.0.1 liblzma.so.5.2.2 libnss_nis.so.2 libresolv.so.2 modules cpp libBrokenLocale.so.1 libfreebl3.chk libm-2.17.so libnss_nisplus-2.17.so librt-2.17.so modules-load.d crda libSegFault.so libfreebl3.so libm.a libnss_nisplus.so.2 librt.a polkit-1debug libanl-2.17.so libfreeblpriv3.chk libm.so.6 libpcprofile.so librt.so.1 python2.7dracut libanl.a libfreeblpriv3.so libmemusage.so libpcre.so.1 libselinux.so.1 rpm firewalld libanl.so.1 libgcc_s-4.8.5-20150702.so.1 libnsl-2.17.so libpcre.so.1.2.0 libsepol.so.1 rtkaio firmware libc-2.17.so libgcc_s.so.1 libnsl.a libpcre16.so.0 libstdc++.so.5 sendmail games libc.a libgio-2.0.so.0 libnsl.so.1 libpcre16.so.0.2.0 libstdc++.so.5.0.7 sendmail.postfix gcc libc.so.6 libgio-2.0.so.0.4600.2 libnss_compat-2.17.so libpcre32.so.0 libstdc++.so.6 sendmail.sendmail gconv libc_stubs.a libglib-2.0.so.0 libnss_compat.so.2 libpcre32.so.0.0.0 libstdc++.so.6.0.19 sse2 gio libcidn-2.17.so libglib-2.0.so.0.4600.2 libnss_db-2.17.so libpcrecpp.so.0 libthread_db-1.0.so sysctl.d grub libcidn.so.1 libgmodule-2.0.so.0 libnss_db.so.2 libpcrecpp.so.0.0.0 libthread_db.so.1 systemd i686 libcrypt-2.17.so libgmodule-2.0.so.0.4600.2 libnss_dns-2.17.so libpcreposix.so.0 libutil-2.17.so tmpfiles.d kbd libcrypt.a libgobject-2.0.so.0 libnss_dns.so.2 libpcreposix.so.0.0.1 libutil.a tuned kdump libcrypt.so.1 libgobject-2.0.so.0.4600.2 libnss_files-2.17.so libpthread-2.17.so libutil.so.1 udev kernel libdl-2.17.so libgthread-2.0.so.0 libnss_files.so.2 libpthread.a libz.so.1 x86_64-redhat-linux6E ld-2.17.so libdl.a libgthread-2.0.so.0.4600.2 libnss_hesiod-2.17.so libpthread.so.0 libz.so.1.2.7 yum-plugins ld-linux.so.2 libdl.so.2
ldd /bin/ls 查看ls依赖的库文件
root@VM_46_188_centos ~]# ldd /bin/ls linux-vdso.so.1 => (0x00007ffde2fd3000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f900ec6b000) libcap.so.2 => /lib64/libcap.so.2 (0x00007f900ea66000) libacl.so.1 => /lib64/libacl.so.1 (0x00007f900e85c000) libc.so.6 => /lib64/libc.so.6 (0x00007f900e49b000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f900e23a000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f900e035000) /lib64/ld-linux-x86-64.so.2 (0x00007f900ee9e000) libattr.so.1 => /lib64/libattr.so.1 (0x00007f900de30000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f900dc14000) [root@VM_46_188_centos ~]#
/media: 光盘、u盘临时挂载
/mnt: 临时挂载目录
/opt: 可挂载
/proc: 进程相关
[root@VM_46_188_centos ~]# ls /proc1 14356 16759 19392 20693 226 2547 27 368 426 4591 7 acpi devices interrupts kmsg modules self timer_list10 15 16763 19528 20752 228 255 28 375 429 4747 768 buddyinfo diskstats iomem kpagecount mounts slabinfo timer_stats11 15013 16822 19801 20753 236 25990 29 39 43 482 769 bus dma ioports kpageflags mtrr softirqs tty1103 15014 16823 2 21 2506 25991 3 405 431 5 8 cgroups driver irq loadavg net stat uptime112 15021 17 20 218 2507 26 30 41 4496 503 887 cmdline execdomains kallsyms locks pagetypeinfo swaps version12 15028 18 20057 222 2508 260 31 415 4501 507 9 consoles fb kcore mdstat partitions sys vmallocinfo13 1576 19 20205 223 2512 261 333 42 4536 509 953 cpuinfo filesystems key-users meminfo sched_debug sysrq-trigger vmstat14 16 19390 20435 224 2546 262 353 424 4590 63 9707 crypto fs keys misc scsi sysvipc zoneinfo [root@VM_46_188_centos ~]#
ls -l /proc/1576/ 查看mysql进程在哪运行
[root@VM_46_188_centos ~]# top -bn1 | grep mysql 887 root 20 0 11764 1568 1260 S 0.0 0.2 0:00.01 mysqld_safe 1576 mysql 20 0 1161832 134220 5484 S 0.0 13.2 3:18.27 mysqld [root@VM_46_188_centos ~]# ls -l /proc/1576/total 0dr-xr-xr-x 2 mysql mysql 0 Aug 5 09:32 attr -rw-r--r-- 1 root root 0 Aug 5 09:32 autogroup -r-------- 1 root root 0 Aug 5 09:32 auxv -r--r--r-- 1 root root 0 Aug 5 09:32 cgroup --w------- 1 root root 0 Aug 5 09:32 clear_refs -r--r--r-- 1 root root 0 Jul 26 17:08 cmdline -rw-r--r-- 1 root root 0 Aug 5 09:32 comm -rw-r--r-- 1 root root 0 Aug 5 09:32 coredump_filter -r--r--r-- 1 root root 0 Aug 5 09:32 cpuset lrwxrwxrwx 1 root root 0 Jul 26 17:09 cwd -> /data/mysql -r-------- 1 root root 0 Jul 26 17:09 environ lrwxrwxrwx 1 root root 0 Jul 26 17:08 exe -> /usr/local/mysql/bin/mysqld dr-x------ 2 root root 0 Jul 26 21:00 fd dr-x------ 2 root root 0 Aug 5 09:32 fdinfo -rw-r--r-- 1 root root 0 Aug 5 09:32 gid_map -r-------- 1 root root 0 Aug 5 09:32 io -r--r--r-- 1 root root 0 Aug 5 09:32 limits -rw-r--r-- 1 root root 0 Aug 5 09:32 loginuid dr-x------ 2 root root 0 Aug 5 09:32 map_files -r--r--r-- 1 root root 0 Aug 5 09:32 maps -rw------- 1 root root 0 Aug 5 09:32 mem -r--r--r-- 1 root root 0 Aug 5 09:32 mountinfo -r--r--r-- 1 root root 0 Aug 5 09:32 mounts -r-------- 1 root root 0 Aug 5 09:32 mountstats dr-xr-xr-x 5 mysql mysql 0 Aug 5 09:32 net dr-x--x--x 2 root root 0 Aug 5 09:32 ns -r--r--r-- 1 root root 0 Aug 5 09:32 numa_maps -rw-r--r-- 1 root root 0 Aug 5 09:32 oom_adj -r--r--r-- 1 root root 0 Aug 5 09:32 oom_score -rw-r--r-- 1 root root 0 Aug 5 09:32 oom_score_adj -r--r--r-- 1 root root 0 Aug 5 09:32 pagemap -r--r--r-- 1 root root 0 Aug 5 09:32 personality -rw-r--r-- 1 root root 0 Aug 5 09:32 projid_map lrwxrwxrwx 1 root root 0 Jul 26 17:09 root -> / -rw-r--r-- 1 root root 0 Aug 5 09:32 sched -r--r--r-- 1 root root 0 Aug 5 09:32 sessionid -rw-r--r-- 1 root root 0 Aug 5 09:32 setgroups -r--r--r-- 1 root root 0 Aug 5 09:32 smaps -r--r--r-- 1 root root 0 Aug 5 09:32 stack-r--r--r-- 1 root root 0 Jul 26 17:08 stat -r--r--r-- 1 root root 0 Jul 26 21:00 statm -r--r--r-- 1 root root 0 Jul 26 17:08 status -r--r--r-- 1 root root 0 Aug 5 09:32 syscall dr-xr-xr-x 26 mysql mysql 0 Aug 5 09:32 task -r--r--r-- 1 root root 0 Aug 5 09:32 timers -rw-r--r-- 1 root root 0 Aug 5 09:32 uid_map -r--r--r-- 1 root root 0 Aug 5 09:32 wchan [root@VM_46_188_centos ~]#
/run: 进程PID存储
[root@VM_46_188_centos ~]# ls /run acpid.pid auditd.pid cron.reboot dmeventd-client initramfs lsm mount plymouth sendmail.pid sm-client.pid systemd udev acpid.socket chronyd.pid crond.pid dmeventd-server lock lvm net-snmp ppp sepermit sshd.pid tmpfiles.d user atd.pid console dbus faillock log lvmetad.pid netreport screen setrans syslogd.pid tuned utmp [root@VM_46_188_centos ~]#
/srv: 服务产生的文件
/sys:系统内核相关的文件
[root@VM_46_188_centos ~]# ls /sysblock bus class dev devices firmware fs hypervisor kernel module power[root@VM_46_188_centos ~]#
/tmp: 临时可写的目录
/usr 用户所用目录
[root@VM_46_188_centos ~]# ls /usrbin etc games include lib lib64 libexec local sbin share src tmp[root@VM_46_188_centos ~]#
/var: 动态日志存储目录 /var/log/日志存放目录
[root@VM_46_188_centos ~]# ls /varadm cache crash db empty games gopher kerberos lib local lock log mail nis opt preserve run spool tmp www yp[root@VM_46_188_centos ~]#
ls /etc/ssh/sshd_config
tree命令
tree -L 2 查看两层目录
[root@VM_46_188_centos ~]# tree -L 2 /root /root |-- #fxq.txt|-- ,|-- ,.pub|-- 1|-- 1.cap|-- 1.ipt|-- 1.log.tar|-- 1.log.tar.bz2|-- 1.log.tar.gz|-- 1.log.tar1.xz|-- 1.log.xz|-- 1.log.zip|-- 1.txt|-- 111.txt|-- 12|-- 123| |-- 123| `-- 123.txt|-- 123.zip|-- 2|-- 2.cap|-- 2.txt|-- 3.txt|-- 4.txt|-- [1-3].log|-- \\fxq.txt|-- a.out|-- anaconda-ks.cfg|-- auto_install_lamp.sh|-- baidu.png|-- dir-2017-05-12|-- ffff|-- gdlogo.png|-- gdlogo.png.1|-- httpd_process_check.sh|-- ip.txt|-- iptables.rules|-- null|-- ping_host_alive.sh|-- sed.txt|-- shell| |-- Xunjian.sh| |-- access_IP_count.sh| |-- add_some_user.sh| |-- auto_install_lamp.sh| |-- case.sh| |-- check_disk_inode_use.sh| |-- check_disk_inode_use1.sh| |-- check_putong_user_conut.sh| |-- del_some_user.sh| |-- deny_access_ip.sh| |-- deny_access_ip_aming.sh| |-- deny_access_ip_aming_xuesheng.sh| |-- disk_check.sh| |-- for.sh| |-- for_mv_name.sh| |-- http_80_check.sh| |-- http_check.sh| |-- httpd_process_check.sh| |-- if.sh| |-- ip.sh| |-- iptables.sh| |-- kill_use_cpu_more.sh| |-- lamp-lnmp_install.sh| |-- lnmp_502_moniter.sh| |-- mem_RSS_count.sh| |-- menu_list_action.sh| |-- menu_list_action_cat.sh| |-- mkdir_zimulu_10.sh| |-- mkdir_zimulu_256.sh| |-- mysql_data_bak.sh| |-- null| |-- passwd| |-- ping_host_check.sh| |-- print_word_count6.sh| |-- rm_zimulu_data.sh| |-- rm_zimulu_data10.sh| |-- sed.sh| `-- stop_nginx_10s.sh|-- weixin| |-- README.md| |-- cache| |-- config.php| |-- include| `-- test.php|-- wordpress-4.7.4-zh_CN.zip|-- youjian.sh `-- ~iptables_rules 8 directories, 80 files [root@VM_46_188_centos ~]#
man帮助文档
man ifconfig 查看ifconfig命令帮助
IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8) NAME ifconfig - configure a network interface SYNOPSIS ifconfig [-v] [-a] [-s] [interface] ifconfig [-v] interface [aftype] options | address ... NOTE This program is obsolete! For replacement check ip addr and ip link. For statistics use ip -s link. DESCRIPTION Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed. If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface. Address Families If the first argument after the interface name is recognized as the name of a supported address family, that address family is used for decoding and displaying all protocol addresses. Currently supported address families include inet (TCP/IP, default), inet6 (IPv6), ax25 (AMPR Packet Radio), ddp (Appletalk Phase 2), ipx (Novell IPX) and netrom (AMPR Packet radio). All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard (that is, a leading 0x or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise, the number is interpreted as decimal). Use of hexadecimal and octal numbers is not RFC-compliant and therefore its use is discouraged. OPTIONS -a display all interfaces which are currently available, even if down -s display a short list (like netstat -i) -v be more verbose for some error conditions interface Manual page ifconfig(8) line 1 (press h for help or q to quit)
二、ls命令
ls 列出文件或目录
root@VM_46_188_centos ~]# ls -ltotal 1712-rw-rw-r-- 1 root root 0 Jul 12 23:16 #fxq.txt
权限 所有者 所属组 大小 mtime 名称
-l 长格式显示
-li 查看文件及目录的inode
-ld 查看目录属性
-lh 人性化的显示文件大小,自己显示文件大小
-la 查看所有文件及目录,包含隐藏文件或目录。
-lt 按时间排序
-lS 按大小排序
ll=ls -l
/bin/ls -l 不显示颜色
[root@VM_46_188_centos ~]# alias llalias ll='ls -l --color=auto'
三、 文件类型
ls -l -rw-r--r-- 1 root root 0 Jul 21 11:27 2017-07-21.sql
文件类型 权限 所有者 所属组 大小 mtime 名称
- 普通文件
cat 查看其内容,/bin/ls 之类的是无法查看的
-rw-r--r-- 1 root root 1270021 Jun 2 23:22 wordpress-4.7.4-zh_CN.zip
d 目录
drwxr-xr-x 2 root root 4096 Jul 23 17:52 shell
c 字符设备
crw--w---- 1 root tty 4, 0 Jul 26 17:08 tty0
l 链接文件
lrwxrwxrwx. 1 root root 7 Apr 21 2016 /bin -> usr/bin
b 块设备 (磁盘)
brw-rw---- 1 root disk 253, 0 Jul 26 17:08 vda
s 套接字文件
(sock) 可用于同一台机器不同进程之间通信
srwxrwxrwx 1 mysql mysql 0 Jul 26 17:08 /data/mysql/mysql.sock
四、 alias命令
1.alias 查看系统设置的别名
[root@VM_46_188_centos ~]# aliasalias cp='cp -i'alias egrep='egrep --color=auto'alias fgrep='fgrep --color=auto'alias grep='grep --color'alias l.='ls -d .* --color=auto'alias ll='ls -l --color=auto'alias ls='ls --color=auto'alias mv='mv -i'alias rm='rm -i'alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
2.echo $PATH 查看环境变量
[root@VM_46_188_centos ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin/:/usr/local/apache2/bin/:/usr/local/php/bin/:/root/bin
3.自定义别名:
alias myls='ls -lha'
which myls 查看设置的别名
unalias myls 取消别名
[root@VM_46_188_centos ~]# alias myls='ls -lha'[root@VM_46_188_centos ~]# which mylsalias myls='ls -lha' /usr/bin/ls [root@VM_46_188_centos ~]# unalias myls [root@VM_46_188_centos ~]# which myls/usr/bin/which: no myls in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin/:/usr/local/apache2/bin/:/usr/local/php/bin/:/root/bin) [root@VM_46_188_centos ~]#
转载于:https://blog.51cto.com/fengyunshan911/1954137