Rhel 7.3 基本操作: 

 1.1 Linux 终端使用,Shell 提示符 Bash shell基本语法  

 1.2 基本命令的使用:ls pwd cd 

 1.3 查看当前系统时间和BIOS硬件时间 

 1.4 Linux 如何获得帮助,Linux开关机命令:shutown init 

 1.5 Linux 7个启动级别,设置服务器在来电后自动开机 



 Keywords[关键词] 

 Terminal:终端 

 netwok-scripts :网络脚本 

 passwd:密码文件 

 nologin:禁止登陆 

 shutdown:关机 

 reboot:重启 

 poweroff:关机 

 grep:过滤  

 localhost:本机 

 useradd:添加用户 

 graphical:图形 



 tty: 控制终端 

 tty1-tty6: 

 tty1:图形界面 

 tty2-6:字符界面 

 图形界面切换到字符界面终端:Ctrl+Alt+F2-6 

 字符界面切换到另外一个字符界面终端:Alt+F2-6 

 字符界面切换到图形界面:Alt+F1 



 pts:虚拟终端 

 新建虚拟终端:Ctrl+Shift+T  

 终端切换:Alt+数字键 

 关闭终端:Alt+F4 

 放大字体:Ctrl+Shift+T + 

 缩小字体:Ctrl+- 





 使用whoami查看当前登录的用户: 

 [root@marklin ~]# whoami 

 root  

 使用who am i 查询当前终端对应的 

 [root@marklin ~]# who am i 

 root     pts/0        2017-08-27 05:13 (:0) 

 [root@marklin ~]#  



 使用w查看pts的进程: 

 [root@marklin ~]# w 

  05:39:30 up 29 min,  2 users,  load average: 0.04, 0.04, 0.08 

 USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT 

 root     :0       :0               05:11   ?xdm?   2:07   0.55s gdm-session-wor 

 root     pts/0    :0               05:13    2.00s  0.13s  0.06s w 

 [root@marklin ~]#  





 ssh 远程连接Linux服务器:ssh 用户名@IP地址 

 [root@marklin ~]# ssh  root@192.168.3.5 

 The authenticity of host '192.168.3.5 (192.168.3.5)' can't be established. 

 ECDSA key fingerprint is aa:24:b8:f8:5d:3c:6c:1c:70:ee:0b:da:37:73:9e:2b. 

 Are you sure you want to continue connecting (yes/no)? yes 

 Warning: Permanently added '192.168.3.5' (ECDSA) to the list of known hosts. 

 root@192.168.3.5's password:  

 Last login: Sun Aug 27 05:11:58 2017 

 [root@marklin ~]#  



 使用grep过滤pts:ps -aux | grep pts 

 [root@marklin ~]# ps -aux | grep pts 

 root       2743  0.0  0.1 116560  3256 pts/0    Ss   05:13   0:00 bash 

 root       3198  0.0  0.3  80720  6828 pts/0    S+   05:41   0:00 ssh root@192.168.3.5 

 root       3199  0.2  0.2 145056  5204 ?        Ss   05:41   0:00 sshd: root@pt/1 

 root       3204  0.0  0.1 116440  3180 pts/1    Ss   05:42   0:00 -bash 

 root       3269  0.0  0.0 153140  1872 pts/1    R+   05:44   0:00 ps -aux 

 root       3270  0.0  0.0 112648   960 pts/1    S+   05:44   0:00 grep --color=auto pts 

 [root@marklin ~]# ^C 

 [root@marklin ~]#  



 pts:pseudo-terminal slave  伪终端:通过ssh 相关连接工具连接上后,显示打印pts 





 Shell 提示符: 

 [用户@主机 当前目录名称]提示符:[root@marklin ~]#   

 其中root为#,而普通用户为:$ 



 Bash Shell 基本语法: 

 Linux 命令: 

 输入命令: 

 命令 空格 [选项]([参数]) 空格 [选项的值] ([参数的值]),空格为分隔符 



 常见选项(参数):-字母 或--加单词 

 -h --help;  





 基本命令操作: 

 ls命令: 

 作用:查看当前目录下有哪些文件 

 语法:ls 目录 ,如果不加目录查看当前目录 

 参数: 

 -I :显示详细信息 系统里面的快捷方式:#II-ls -I 

 -a:显示隐藏文件 

 -d:查看目录,不查看里面的内容  

 -h:方便阅读文件大小 



 使用ls 查看当前目录: 

 [root@marklin ~]# ls 

 anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates 

 Desktop          Downloads  Music                 Public    Videos 

 [root@marklin ~]#  



 [root@marklin ~]# ls -h 

 anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates 

 Desktop          Downloads  Music                 Public    Videos 

 [root@marklin ~]#  





 使用ls -lh 查看当前目录详情: 

 [root@marklin ~]# ls -lh 

 total 8.0K 

 -rw-------. 1 root root 1.9K Aug 27 05:03 anaconda-ks.cfg 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Desktop 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Documents 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Downloads 

 -rw-r--r--. 1 root root 2.0K Aug 27 05:11 initial-setup-ks.cfg 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Music 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Pictures 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Public 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Templates 

 drwxr-xr-x. 2 root root    6 Aug 27 05:11 Videos 

 [root@marklin ~]#  



 讲解: 

 权限      连接数    用户名      文件大小     文件创建日期         具体文件名 

 -rw-------. 1       root root   1.9K        Aug 27 05:03        anaconda-ks.cfg 



 使用ls -a 显示隐藏文件: 

 [root@marklin ~]# ls -a 

 .                .bashrc  Documents        initial-setup-ks.cfg  .ssh 

 ..               .cache   Downloads        .local                .tcshrc 

 anaconda-ks.cfg  .config  .esd_auth        .mozilla              Templates 

 .bash_history    .cshrc   .gnome2          Music                 Videos 

 .bash_logout     .dbus    .gnome2_private  Pictures 

 .bash_profile    Desktop  .ICEauthority    Public 

 [root@marklin ~]#  



 使用cd +目录 切换目录: 

 [root@marklin ~]# ls 

 anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates 

 Desktop          Downloads  Music                 Public    Videos 

 [root@marklin ~]# cd Desktop 

 [root@marklin Desktop]#  







 [root@marklin ~]# ls -l /etc 

 total 1452 

 drwxr-xr-x.  3 root root      101 Aug 27 04:51 abrt 

 -rw-r--r--.  1 root root       16 Aug 27 05:02 adjtime 

 drwxr-xr-x.  2 root root      116 Aug 27 04:55 akonadi 

 -rw-r--r--.  1 root root     1518 Jun  7  2013 aliases 

 -rw-r--r--.  1 root root    12288 Aug 27 05:10 aliases.db 

 drwxr-xr-x.  2 root root       51 Aug 27 04:51 alsa 

 drwxr-xr-x.  2 root root     4096 Aug 27 05:01 alternatives 

 -rw-------.  1 root root      541 Feb 23  2016 anacrontab 

 -rw-r--r--.  1 root root       55 Jun  6  2016 asound.conf 

 -rw-r--r--.  1 root root        1 May 23  2016 at.deny 

 drwxr-xr-x.  2 root root       32 Aug 27 04:53 at-spi2 

 drwxr-x---.  3 root root       43 Aug 27 04:51 audisp 

 drwxr-x---.  3 root root       83 Aug 27 05:10 audit 

 drwxr-xr-x.  4 root root       71 Aug 27 04:56 avahi 

 drwxr-xr-x.  2 root root     4096 Aug 27 04:57 bash_completion.d 

 -rw-r--r--.  1 root root     2853 May  4  2016 bashrc 

 drwxr-xr-x.  2 root root        6 Sep 13  2016 binfmt.d 

 drwxr-xr-x.  2 root root       23 Aug 27 04:50 bluetooth 

 drwxr-xr-x.  2 root root       42 Aug 27 04:48 bonobo-activation 

 drwxr-xr-x.  2 root root    12288 Aug 27 04:52 brltty 

 -rw-r--r--.  1 root root    21929 May  6  2016 brltty.conf 

 -rw-r--r--.  1 root root      676 Jun 23  2016 cgconfig.conf 

 drwxr-xr-x.  2 root root        6 Jun 23  2016 cgconfig.d 

 -rw-r--r--.  1 root root      234 Jun 23  2016 cgrules.conf 

 -rw-r--r--.  1 root root      131 Jun 23  2016 cgsnapshot_blacklist.conf 

 drwxr-xr-x.  2 root root        6 Jun 29  2016 chkconfig.d 

 -rw-r--r--.  1 root root     1157 Jun 28  2016 chrony.conf 

 -rw-r-----.  1 root chrony      9 Jun 28  2016 chrony.keys 

 drwxr-xr-x.  2 root root       26 Aug 27 04:56 cifs-utils 

 drwxr-xr-x.  2 root root       54 Aug 27 04:56 cron.d 

 drwxr-xr-x.  2 root root       70 Aug 27 04:56 cron.daily 

 -rw-------.  1 root root        0 Feb 23  2016 cron.deny 

 drwxr-xr-x.  2 root root       41 Aug 27 04:56 cron.hourly 

 drwxr-xr-x.  2 root root        6 Dec 28  2013 cron.monthly 

 -rw-r--r--.  1 root root      451 Dec 28  2013 crontab 

 drwxr-xr-x.  2 root root        6 Dec 28  2013 cron.weekly 

 -rw-------.  1 root root        0 Aug 27 04:46 crypttab 

 -rw-r--r--.  1 root root     1620 May  4  2016 csh.cshrc 

 -rw-r--r--.  1 root root      841 Jun  7  2013 csh.login 

 drwxr-xr-x.  5 root lp       4096 Aug 27 06:10 cups 

 drwxr-xr-x.  2 root root       34 Aug 27 04:52 cupshelpers 

 drwxr-xr-x.  4 root root       78 Aug 27 04:50 dbus-1 

 drwxr-xr-x.  4 root root       31 Aug 27 04:50 dconf 

 drwxr-xr-x.  2 root root       44 Aug 27 05:02 default 

 drwxr-xr-x.  2 root root       23 Aug 27 04:50 depmod.d 

 drwxr-x---.  3 root root       24 Aug 27 04:50 dhcp 

 -rw-r--r--.  1 root root     5090 Jun 30  2016 DIR_COLORS 

 -rw-r--r--.  1 root root     5725 Jun 30  2016 DIR_COLORS.256color 

 -rw-r--r--.  1 root root     4669 Jun 30  2016 DIR_COLORS.lightbgcolor 

 -rw-r--r--.  1 root root     1131 Jun  2  2015 dleyna-server-service.conf 

 -rw-r--r--.  1 root root    25213 Sep 13  2016 dnsmasq.conf 

 drwxr-xr-x.  2 root root        6 Sep 13  2016 dnsmasq.d 

 -rw-r--r--.  1 root root     1285 Oct  5  2016 dracut.conf 

 drwxr-xr-x.  2 root root        6 Oct  5  2016 dracut.conf.d 

 -rw-r--r--.  1 root root     4346 Aug 10  2016 drirc 

 -rw-r--r--.  1 root root      112 Jun 13  2016 e2fsck.conf 

 -rw-r--r--.  1 root root     4760 Jan 25  2014 enscript.cfg 

 -rw-r--r--.  1 root root        0 May  4  2016 environment 

 -rw-r--r--.  1 root root     1317 Jun 30  2016 ethertypes 

 -rw-r--r--.  1 root root        0 Jun  7  2013 exports 

 drwxr-xr-x.  2 root root        6 Aug 17  2016 exports.d 

 lrwxrwxrwx.  1 root root       56 Aug 27 04:48 favicon.png -> /usr/share/icons/hicolor/16x16/apps/fedora-logo-icon.png 

 drwxr-xr-x.  2 root root       22 Aug 27 04:51 fcoe 

 drwxr-xr-x.  2 root root       46 Aug 27 04:52 festival 

 -rw-r--r--.  1 root root       70 May  4  2016 filesystems 

 drwxr-xr-x.  3 root root       18 Aug 27 04:55 firefox 

 drwxr-x---.  5 root root      104 Aug 27 04:51 firewalld 

 drwxr-xr-x.  3 root root       38 Aug 27 04:48 fonts 

 -rw-r--r--.  1 root root       20 May 12  2014 fprintd.conf 

 -rw-r--r--.  1 root root      501 Aug 27 04:46 fstab 

 -rw-r--r--.  1 root root       38 May 19  2016 fuse.conf 

 drwxr-xr-x.  7 root root      107 Aug 27 04:50 gconf 

 drwxr-xr-x.  2 root root        6 Apr 10  2015 gcrypt 

 -rw-r--r--.  1 root root      265 Aug  4  2016 gdbinit 

 drwxr-xr-x.  2 root root        6 Aug  4  2016 gdbinit.d 

 drwxr-xr-x.  6 root root      107 Aug 27 04:54 gdm 

 drwxr-xr-x.  2 root root       26 Aug 27 04:51 geoclue 

 -rw-r--r--.  1 root root      842 Jun 29  2016 GeoIP.conf 

 -rw-r--r--.  1 root root      858 Jun 29  2016 GeoIP.conf.default 

 drwxr-xr-x.  3 root root       18 Aug 27 04:52 ghostscript 

 drwxr-xr-x.  3 root root       21 Aug 27 04:53 gnome-vfs-2.0 

 drwxr-xr-x.  2 root root        6 Mar 24  2016 gnupg 

 -rw-r--r--.  1 root root       94 Apr 29  2015 GREP_COLORS 

 drwxr-xr-x.  4 root root       40 Aug 27 04:48 groff 

 -rw-r--r--.  1 root root      962 Aug 27 05:02 group 

 -rw-r--r--.  1 root root      955 Aug 27 05:02 group- 

 lrwxrwxrwx.  1 root root       22 Aug 27 04:56 grub2.cfg -> ../boot/grub2/grub.cfg 

 drwx------.  2 root root      182 Aug 27 05:01 grub.d 

 ----------.  1 root root      778 Aug 27 05:02 gshadow 

 ----------.  1 root root      771 Aug 27 05:02 gshadow- 

 drwxr-xr-x.  3 root root       20 Aug 27 04:48 gss 

 drwxr-xr-x.  2 root root       27 Aug 27 04:51 gssproxy 

 -rw-r--r--.  1 root root        9 Jun  7  2013 host.conf 

 -rw-r--r--.  1 root root       12 Aug 27 05:02 hostname 

 -rw-r--r--.  1 root root      158 Jun  7  2013 hosts 

 -rw-r--r--.  1 root root      370 Jun  7  2013 hosts.allow 

 -rw-r--r--.  1 root root      460 Jun  7  2013 hosts.deny 

 drwxr-xr-x.  2 root root       24 Aug 27 04:51 hp 

 -rw-r--r--.  1 root root     3580 Aug 18  2016 idmapd.conf 

 lrwxrwxrwx.  1 root root       11 Aug 27 04:47 init.d -> rc.d/init.d 

 -rw-r--r--.  1 root root      511 Sep 12  2016 inittab 

 -rw-r--r--.  1 root root      942 Jun  7  2013 inputrc 

 drwxr-xr-x.  2 root root      140 Aug 27 04:48 iproute2 

 -rw-r--r--.  1 root root     2380 Sep 14  2016 ipsec.conf 

 drwx------.  3 root root       50 Aug 27 04:51 ipsec.d 

 -rw-------.  1 root root       31 Sep 14  2016 ipsec.secrets 

 drwxr-xr-x.  2 root root       52 Aug 27 04:50 iscsi 

 -rw-r--r--.  1 root root       23 Sep 27  2016 issue 

 -rw-r--r--.  1 root root       22 Sep 27  2016 issue.net 

 drwxr-xr-x.  3 root root       62 Aug 27 04:48 java 

 drwxr-xr-x.  2 root root        6 Jul  2  2015 jvm 

 drwxr-xr-x.  2 root root        6 Jul  2  2015 jvm-commmon 

 drwxr-xr-x.  5 root root       44 Aug 27 04:49 kde 

 -rw-r--r--.  1 root root      271 Jul  9  2008 kde4rc 

 -rw-r--r--.  1 root root      204 Jul  9  2008 kderc 

 -rw-r--r--.  1 root root     6920 Aug 27 04:51 kdump.conf 

 drwxr-xr-x.  3 root root       24 Aug 27 04:56 kernel 

 -rw-r--r--.  1 root root      590 Aug 19  2016 krb5.conf 

 drwxr-xr-x.  2 root root        6 Aug 19  2016 krb5.conf.d 

 -rw-r--r--.  1 root root      478 Sep 20  2016 ksmtuned.conf 

 -rw-r--r--.  1 root root     1174 May  8  2015 ksysguarddrc 

 -rw-r--r--.  1 root root    97053 Aug 27 05:01 ld.so.cache 

 -rw-r--r--.  1 root root       28 Feb 28  2013 ld.so.conf 

 drwxr-xr-x.  2 root root      151 Aug 27 04:53 ld.so.conf.d 

 -rw-r-----.  1 root root      191 Jul 14  2016 libaudit.conf 

 drwxr-xr-x.  2 root root        6 Jul 20  2016 libibverbs.d 

 drwxr-xr-x.  2 root root       35 Aug 27 04:47 libnl 

 drwxr-xr-x.  6 root root      149 Aug 27 04:49 libreport 

 -rw-r--r--.  1 root root     2391 Oct 13  2013 libuser.conf 

 drwx------.  4 root root      184 Aug 27 04:52 libvirt 

 -rw-r--r--.  1 root root       19 Aug 27 05:02 locale.conf 

 lrwxrwxrwx.  1 root root       35 Aug 27 05:02 localtime -> ../usr/share/zoneinfo/Asia/Shanghai 

 -rw-r--r--.  1 root root     2028 Jun 28  2016 login.defs 

 -rw-r--r--.  1 root root      662 Jul 31  2013 logrotate.conf 

 drwxr-xr-x.  2 root root      244 Aug 27 04:56 logrotate.d 

 drwxr-xr-x.  3 root root       43 Aug 27 04:50 lsm 

 drwxr-xr-x.  6 root root      100 Aug 27 04:51 lvm 

 -r--r--r--.  1 root root       33 Aug 27 04:50 machine-id 

 -rw-r--r--.  1 root root      111 Jun 27  2016 magic 

 -rw-r--r--.  1 root root      272 May 15  2013 mailcap 

 -rw-r--r--.  1 root root     1968 Dec 10  2014 mail.rc 

 -rw-r--r--.  1 root root     5122 Sep  5  2016 makedumpfile.conf.sample 

 -rw-r--r--.  1 root root     5171 Mar 18  2014 man_db.conf 

 drwxr-xr-x.  2 root root        6 Jul  2  2015 maven 

 drwxr-xr-x.  3 root root       61 Aug 27 04:56 mcelog 

 -rw-r--r--.  1 root root    51787 May 15  2013 mime.types 

 -rw-r--r--.  1 root root      936 Jun 13  2016 mke2fs.conf 

 drwxr-xr-x.  2 root root       59 Aug 27 04:56 modprobe.d 

 drwxr-xr-x.  2 root root        6 Sep 13  2016 modules-load.d 

 -rw-r--r--.  1 root root        0 Jun  7  2013 motd 

 lrwxrwxrwx.  1 root root       17 Aug 27 04:46 mtab -> /proc/self/mounts 

 -rw-r--r--.  1 root root     2620 Jan 27  2014 mtools.conf 

 drwxr-xr-x.  2 root root        6 Sep  8  2016 multipath 

 -rw-r--r--.  1 root root      570 Sep 21  2016 my.cnf 

 drwxr-xr-x.  2 root root       67 Aug 27 04:51 my.cnf.d 

 -rw-r--r--.  1 root root     8892 Jan 27  2014 nanorc 

 -rw-r--r--.  1 root root      767 Jun  6  2016 netconfig 

 drwxr-xr-x.  8 root root      145 Aug 27 04:51 NetworkManager 

 -rw-r--r--.  1 root root       58 Sep 12  2016 networks 

 -rw-r--r--.  1 root root     3390 Aug 17  2016 nfsmount.conf 

 -rw-r--r--.  1 root root     1728 Aug 27 05:02 nsswitch.conf 

 -rw-r--r--.  1 root root     1726 Oct 22  2012 nsswitch.conf.bak 

 drwxr-xr-x.  2 root root       38 Aug 27 04:56 ntp 

 -rw-r--r--.  1 root root       91 Dec  3  2012 numad.conf 

 drwxr-xr-x.  2 root root        6 Sep 10  2014 oddjob 

 -rw-r--r--.  1 root root     4922 Sep 10  2014 oddjobd.conf 

 drwxr-xr-x.  2 root root       70 Aug 27 04:51 oddjobd.conf.d 

 drwxr-xr-x.  3 root root       36 Aug 27 04:49 openldap 

 drwxr-xr-x.  2 root root        6 Mar 10  2016 opt 

 -rw-r--r--.  1 root root      495 Sep 27  2016 os-release 

 drwxr-xr-x.  2 root root       92 Aug 27 04:56 PackageKit 

 drwxr-xr-x.  2 root root     4096 Aug 27 05:02 pam.d 

 -rw-r--r--.  1 root root     2254 Aug 27 05:02 passwd 

 -rw-r--r--.  1 root root     2254 Aug 27 05:02 passwd- 

 -rw-r--r--.  1 root root     1362 Jan 27  2014 pbm2ppa.conf 

 -rw-r--r--.  1 root root     2872 Jan 27  2014 pinforc 

 drwxr-xr-x.  3 root root       21 Aug 27 04:47 pkcs11 

 drwxr-xr-x. 13 root root      171 Aug 27 05:10 pki 

 drwxr-xr-x.  2 root root       28 Aug 27 04:52 plymouth 

 drwxr-xr-x.  5 root root       52 Aug 27 04:47 pm 

 -rw-r--r--.  1 root root     6300 Jan 27  2014 pnm2ppa.conf 

 drwxr-xr-x.  5 root root       72 Aug 27 04:50 polkit-1 

 drwxr-xr-x.  2 root root        6 Jan 27  2014 popt.d 

 drwxr-xr-x.  2 root root      154 Aug 27 04:56 postfix 

 drwxr-xr-x.  3 root root      219 Aug 27 04:50 ppp 

 drwxr-xr-x.  2 root root      105 Aug 27 04:51 prelink.conf.d 

 -rw-r--r--.  1 root root      233 Jun  7  2013 printcap 

 -rw-r--r--.  1 root root     1795 May  4  2016 profile 

 drwxr-xr-x.  2 root root     4096 Aug 27 04:56 profile.d 

 -rw-r--r--.  1 root root     6545 Jun  7  2013 protocols 

 drwxr-xr-x.  2 root root       79 Aug 27 04:52 pulse 

 drwxr-xr-x.  2 root root       23 Aug 27 04:52 purple 

 drwxr-xr-x.  2 root root       35 Aug 27 04:48 python 

 drwxr-xr-x.  3 root root       50 Aug 27 04:56 qemu-ga 

 drwxr-xr-x.  2 root root       51 Aug 27 04:53 qemu-kvm 

 -rw-r--r--.  1 root root      433 Aug 17  2015 radvd.conf 

 drwxr-xr-x.  3 root root       27 Aug 27 04:56 ras 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc0.d -> rc.d/rc0.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc1.d -> rc.d/rc1.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc2.d -> rc.d/rc2.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc3.d -> rc.d/rc3.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc4.d -> rc.d/rc4.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc5.d -> rc.d/rc5.d 

 lrwxrwxrwx.  1 root root       10 Aug 27 04:47 rc6.d -> rc.d/rc6.d 

 drwxr-xr-x. 10 root root      127 Aug 27 04:50 rc.d 

 lrwxrwxrwx.  1 root root       13 Aug 27 04:50 rc.local -> rc.d/rc.local 

 drwxr-xr-x.  2 root root       57 Aug 27 04:51 rdma 

 drw-------.  2 root root      238 Aug 27 04:51 redhat-access-insights 

 -rw-r--r--.  1 root root       52 Sep 27  2016 redhat-release 

 -rw-r--r--.  1 root root     1787 Jan 26  2014 request-key.conf 

 drwxr-xr-x.  2 root root       30 Aug 27 04:52 request-key.d 

 -rw-r--r--.  1 root root       68 Aug 27 05:10 resolv.conf 

 drwxr-xr-x.  5 root root       86 Aug 27 04:52 rhsm 

 -rw-r--r--.  1 root root     1634 Dec 25  2012 rpc 

 drwxr-xr-x.  2 root root     4096 Aug 27 04:51 rpm 

 -rw-r--r--.  1 root root      458 Jun 24  2015 rsyncd.conf 

 -rw-r--r--.  1 root root     3232 Jul 14  2016 rsyslog.conf 

 drwxr-xr-x.  2 root root       25 Jul 14  2016 rsyslog.d 

 -rw-r--r--.  1 root root      928 Sep 12  2016 rwtab 

 drwxr-xr-x.  2 root root       23 Sep 12  2016 rwtab.d 

 drwxr-xr-x.  2 root root       61 Aug 27 04:50 samba 

 drwxr-xr-x.  3 root root     4096 Aug 27 04:53 sane.d 

 drwxr-xr-x.  2 root root       65 Aug 27 04:56 sasl2 

 drwxr-xr-x.  3 root root       34 Aug 27 04:57 scl 

 -rw-------.  1 root root      221 May  4  2016 securetty 

 drwxr-xr-x.  6 root root     4096 Aug 27 04:48 security 

 drwxr-xr-x.  5 root root       81 Aug 27 04:50 selinux 

 -rw-r--r--.  1 root root   670293 Jun  7  2013 services 

 -rw-r--r--.  1 root root      216 Aug 26  2016 sestatus.conf 

 drwxr-xr-x.  2 root root       33 Aug 27 04:51 setroubleshoot 

 drwxr-xr-x.  2 root root     4096 Aug 27 04:56 setuptool.d 

 drwxr-xr-x.  3 root root     4096 Aug 27 04:49 sgml 

 ----------.  1 root root     1256 Aug 27 05:02 shadow 

 ----------.  1 root root     1261 Aug 27 05:02 shadow- 

 -rw-r--r--.  1 root root       95 Aug 27 04:56 shells 

 drwxr-xr-x.  3 root root       78 Aug 27 04:47 skel 

 drwxr-xr-x.  3 root root       74 Aug 27 04:56 smartmontools 

 -rw-r--r--.  1 root root      100 Sep  9  2016 sos.conf 

 drwxr-xr-x.  3 root root       20 Aug 27 04:53 sound 

 drwxr-xr-x.  4 root root       56 Aug 27 04:53 speech-dispatcher 

 drwxr-xr-x.  2 root root      225 Aug 27 05:10 ssh 

 drwxr-xr-x.  2 root root       19 Aug 27 04:48 ssl 

 -rw-r--r--.  1 root root      212 Sep 12  2016 statetab 

 drwxr-xr-x.  2 root root        6 Sep 12  2016 statetab.d 

 -rw-r--r--.  1 root root        0 May  4  2016 subgid 

 -rw-r--r--.  1 root root        0 May  4  2016 subuid 

 drwxr-xr-x.  2 root root        6 Aug 13  2015 subversion 

 -rw-r-----.  1 root root     1786 Jul 19  2016 sudo.conf 

 -r--r-----.  1 root root     3907 Jul 19  2016 sudoers 

 drwxr-x---.  2 root root        6 Jul 19  2016 sudoers.d 

 -rw-r-----.  1 root root     3181 Jul 19  2016 sudo-ldap.conf 

 drwxr-xr-x.  7 root root     4096 Aug 27 05:10 sysconfig 

 -rw-r--r--.  1 root root      449 Sep 12  2016 sysctl.conf 

 drwxr-xr-x.  2 root root       28 Aug 27 04:50 sysctl.d 

 drwxr-xr-x.  4 root root      151 Aug 27 04:50 systemd 

 lrwxrwxrwx.  1 root root       14 Aug 27 04:47 system-release -> redhat-release 

 -rw-r--r--.  1 root root       45 Sep 27  2016 system-release-cpe 

 -rw-------.  1 tss  tss      7046 May 25  2015 tcsd.conf 

 drwxr-xr-x.  2 root root        6 Jan 27  2014 terminfo 

 drwxr-xr-x.  2 root root        6 Sep 13  2016 tmpfiles.d 

 -rw-r--r--.  1 root root       45 May 10  2012 Trolltech.conf 

 -rw-r--r--.  1 root root      375 Sep 26  2016 trusted-key.key 

 drwxr-xr-x.  2 root root       70 Aug 27 04:56 tuned 

 drwxr-xr-x.  3 root root       54 Aug 27 05:10 udev 

 drwxr-xr-x.  2 root root        6 Jul  2  2015 udisks2 

 drwxr-xr-x.  2 root root       68 Aug 27 04:50 unbound 

 -rw-r--r--.  1 root root      513 Feb  4  2016 updatedb.conf 

 drwxr-xr-x.  2 root root       25 Aug 27 04:50 UPower 

 -rw-r--r--.  1 root root     1018 Jul 25  2016 usb_modeswitch.conf 

 -rw-r--r--.  1 root root       37 Aug 27 05:02 vconsole.conf 

 -rw-r--r--.  1 root root     1982 Jan 30  2014 vimrc 

 -rw-r--r--.  1 root root     1982 Jan 30  2014 virc 

 drwxr-xr-x.  2 root root       26 Aug 27 04:49 virtuoso 

 drwxr-xr-x.  4 root root      198 Aug 27 04:51 vmware-tools 

 -rw-r--r--.  1 root root     4479 Jun 21  2016 wgetrc 

 drwxr-xr-x.  2 root root       33 Aug 27 04:50 wpa_supplicant 

 -rw-r--r--.  1 root root        0 Jan 28  2014 wvdial.conf 

 drwxr-xr-x.  6 root root      103 Aug 27 04:52 X11 

 drwxr-xr-x.  6 root root      114 Aug 27 04:52 xdg 

 drwxr-xr-x.  2 root root        6 Mar 10  2016 xinetd.d 

 drwxr-xr-x.  2 root root       21 Aug 27 04:48 xml 

 drwxr-xr-x.  6 root root      100 Aug 27 04:50 yum 

 -rw-r--r--.  1 root root      813 Sep 19  2016 yum.conf 

 drwxr-xr-x.  2 root root        6 Sep 19  2016 yum.repos.d 

 [root@marklin ~]#  



 使用ls -ld+文件目录:查看具体某一个文件 

 [root@marklin ~]# ls -ld /etc 

 drwxr-xr-x. 143 root root 8192 Aug 27 05:10 /etc 

 [root@marklin ~]#  



 使用ls -lh+文件目录 :方便阅读 

 [root@marklin ~]# ls -lh /etc 

 drwxr-xr-x. 143 root root 8192 Aug 27 05:10 /etc 

 [root@marklin ~]#  



 .:当前目录 

 ..:父级目录,上层目录 



 linux目录文件有不同的颜色,不同颜色代表的意思: 

 颜色           名称          实例 

 蓝色           目录          /etc 

 黑色           文件          /etc/passwd 

 浅蓝色         链接          /etc/grub2.cfg 

 红色           压缩包        boot.tar.gz 

 绿色           可执行文件    /etc/init.d/network 

 黑底黄字       设备文件      /dev/sda 





 pwd命令: 

 作用:查看当前目录 

 语法:pwd 没有参数 



 [root@marklin ~]# pwd 

 /root 





 cd 命令: 

 作用:切换目录 

 语法:cd+目录名 

 #cd  回到用户自己主目录 

 [root@marklin Desktop]# cd 

 [root@marklin ~]#  



 #cd ~ 回到用户自己的主目录 

 [root@marklin ~]# cd 

 [root@marklin ~]#  



 #cd /etcsysconfig 和#cd /etc/sysconfig 一样 

 #cd /etc/ 和#cd /etc 一样 



 使date查看当前时间: 

 [root@marklin ~]# date 

 Sun Aug 27 06:32:09 CST 2017 



 使用hwclock查看bios硬件时间: 

 [root@marklin ~]# hwclock 

 Sun 27 Aug 2017 06:33:58 AM CST  -1.027048 seconds 

 [root@marklin ~]#  



 在rhel6以前,系统时间和硬件时间bios时间是不一样的,因为时差,差8小时 

 操作系统会以bios时间为系统比哦啊准时间 



 帮助参数-h 和--help: 

 date --help 和date -h :查看date 帮助文档 

 [root@marklin ~]# date --help 

 Usage: date [OPTION]... [+FORMAT] 

   or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 

 Display the current time in the given FORMAT, or set the system date. 



 Mandatory arguments to long options are mandatory for short options too. 

   -d, --date=STRING         display time described by STRING, not 'now' 

   -f, --file=DATEFILE       like --date once for each line of DATEFILE 

   -I[TIMESPEC], --iso-8601[=TIMESPEC]  output date/time in ISO 8601 format. 

                             TIMESPEC='date' for date only (the default), 

                             'hours', 'minutes', 'seconds', or 'ns' for date 

                             and time to the indicated precision. 

   -r, --reference=FILE      display the last modification time of FILE 

   -R, --rfc-2822            output date and time in RFC 2822 format. 

                             Example: Mon, 07 Aug 2006 12:34:56 -0600 

       --rfc-3339=TIMESPEC   output date and time in RFC 3339 format. 

                             TIMESPEC='date', 'seconds', or 'ns' for 

                             date and time to the indicated precision. 

                             Date and time components are separated by 

                             a single space: 2006-08-07 12:34:56-06:00 

   -s, --set=STRING          set time described by STRING 

   -u, --utc, --universal    print or set Coordinated Universal Time (UTC) 

       --help     display this help and exit 

       --version  output version information and exit 



 FORMAT controls the output.  Interpreted sequences are: 



   %%   a literal % 

   %a   locale's abbreviated weekday name (e.g., Sun) 

   %A   locale's full weekday name (e.g., Sunday) 

   %b   locale's abbreviated month name (e.g., Jan) 

   %B   locale's full month name (e.g., January) 

   %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005) 

   %C   century; like %Y, except omit last two digits (e.g., 20) 

   %d   day of month (e.g., 01) 

   %D   date; same as %m/%d/%y 

   %e   day of month, space padded; same as %_d 

   %F   full date; same as %Y-%m-%d 

   %g   last two digits of year of ISO week number (see %G) 

   %G   year of ISO week number (see %V); normally useful only with %V 

   %h   same as %b 

   %H   hour (00..23) 

   %I   hour (01..12) 

   %j   day of year (001..366) 

   %k   hour, space padded ( 0..23); same as %_H 

   %l   hour, space padded ( 1..12); same as %_I 

   %m   month (01..12) 

   %M   minute (00..59) 

   %n   a newline 

   %N   nanoseconds (000000000..999999999) 

   %p   locale's equivalent of either AM or PM; blank if not known 

   %P   like %p, but lower case 

   %r   locale's 12-hour clock time (e.g., 11:11:04 PM) 

   %R   24-hour hour and minute; same as %H:%M 

   %s   seconds since 1970-01-01 00:00:00 UTC 

   %S   second (00..60) 

   %t   a tab 

   %T   time; same as %H:%M:%S 

   %u   day of week (1..7); 1 is Monday 

   %U   week number of year, with Sunday as first day of week (00..53) 

   %V   ISO week number, with Monday as first day of week (01..53) 

   %w   day of week (0..6); 0 is Sunday 

   %W   week number of year, with Monday as first day of week (00..53) 

   %x   locale's date representation (e.g., 12/31/99) 

   %X   locale's time representation (e.g., 23:13:48) 

   %y   last two digits of year (00..99) 

   %Y   year 

   %z   +hhmm numeric time zone (e.g., -0400) 

   %:z  +hh:mm numeric time zone (e.g., -04:00) 

   %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00) 

   %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30) 

   %Z   alphabetic time zone abbreviation (e.g., EDT) 



 By default, date pads numeric fields with zeroes. 

 The following optional flags may follow '%': 



   -  (hyphen) do not pad the field 

   _  (underscore) pad with spaces 

   0  (zero) pad with zeros 

   ^  use upper case if possible 

   #  use opposite case if possible 



 After any flags comes an optional field width, as a decimal number; 

 then an optional modifier, which is either 

 E to use the locale's alternate representations if available, or 

 O to use the locale's alternate numeric symbols if available. 



 Examples: 

 Convert seconds since the epoch (1970-01-01 UTC) to a date 

   $ date --date='@2147483647' 



 Show the time on the west coast of the US (use tzselect(1) to find TZ) 

   $ TZ='America/Los_Angeles' date 



 Show the local time for 9AM next Friday on the west coast of the US 

   $ date --date='TZ="America/Los_Angeles" 09:00 next Fri' 



 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 

 For complete documentation, run: info coreutils 'date invocation' 

 [root@marklin ~]#  



 fdisk -- help  fdisk -h: 

 [root@marklin ~]# data -h 

 bash: data: command not found... 

 [root@marklin ~]# date --help 

 Usage: date [OPTION]... [+FORMAT] 

   or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 

 Display the current time in the given FORMAT, or set the system date. 



 Mandatory arguments to long options are mandatory for short options too. 

   -d, --date=STRING         display time described by STRING, not 'now' 

   -f, --file=DATEFILE       like --date once for each line of DATEFILE 

   -I[TIMESPEC], --iso-8601[=TIMESPEC]  output date/time in ISO 8601 format. 

                             TIMESPEC='date' for date only (the default), 

                             'hours', 'minutes', 'seconds', or 'ns' for date 

                             and time to the indicated precision. 

   -r, --reference=FILE      display the last modification time of FILE 

   -R, --rfc-2822            output date and time in RFC 2822 format. 

                             Example: Mon, 07 Aug 2006 12:34:56 -0600 

       --rfc-3339=TIMESPEC   output date and time in RFC 3339 format. 

                             TIMESPEC='date', 'seconds', or 'ns' for 

                             date and time to the indicated precision. 

                             Date and time components are separated by 

                             a single space: 2006-08-07 12:34:56-06:00 

   -s, --set=STRING          set time described by STRING 

   -u, --utc, --universal    print or set Coordinated Universal Time (UTC) 

       --help     display this help and exit 

       --version  output version information and exit 



 FORMAT controls the output.  Interpreted sequences are: 



   %%   a literal % 

   %a   locale's abbreviated weekday name (e.g., Sun) 

   %A   locale's full weekday name (e.g., Sunday) 

   %b   locale's abbreviated month name (e.g., Jan) 

   %B   locale's full month name (e.g., January) 

   %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005) 

   %C   century; like %Y, except omit last two digits (e.g., 20) 

   %d   day of month (e.g., 01) 

   %D   date; same as %m/%d/%y 

   %e   day of month, space padded; same as %_d 

   %F   full date; same as %Y-%m-%d 

   %g   last two digits of year of ISO week number (see %G) 

   %G   year of ISO week number (see %V); normally useful only with %V 

   %h   same as %b 

   %H   hour (00..23) 

   %I   hour (01..12) 

   %j   day of year (001..366) 

   %k   hour, space padded ( 0..23); same as %_H 

   %l   hour, space padded ( 1..12); same as %_I 

   %m   month (01..12) 

   %M   minute (00..59) 

   %n   a newline 

   %N   nanoseconds (000000000..999999999) 

   %p   locale's equivalent of either AM or PM; blank if not known 

   %P   like %p, but lower case 

   %r   locale's 12-hour clock time (e.g., 11:11:04 PM) 

   %R   24-hour hour and minute; same as %H:%M 

   %s   seconds since 1970-01-01 00:00:00 UTC 

   %S   second (00..60) 

   %t   a tab 

   %T   time; same as %H:%M:%S 

   %u   day of week (1..7); 1 is Monday 

   %U   week number of year, with Sunday as first day of week (00..53) 

   %V   ISO week number, with Monday as first day of week (01..53) 

   %w   day of week (0..6); 0 is Sunday 

   %W   week number of year, with Monday as first day of week (00..53) 

   %x   locale's date representation (e.g., 12/31/99) 

   %X   locale's time representation (e.g., 23:13:48) 

   %y   last two digits of year (00..99) 

   %Y   year 

   %z   +hhmm numeric time zone (e.g., -0400) 

   %:z  +hh:mm numeric time zone (e.g., -04:00) 

   %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00) 

   %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30) 

   %Z   alphabetic time zone abbreviation (e.g., EDT) 



 By default, date pads numeric fields with zeroes. 

 The following optional flags may follow '%': 



   -  (hyphen) do not pad the field 

   _  (underscore) pad with spaces 

   0  (zero) pad with zeros 

   ^  use upper case if possible 

   #  use opposite case if possible 



 After any flags comes an optional field width, as a decimal number; 

 then an optional modifier, which is either 

 E to use the locale's alternate representations if available, or 

 O to use the locale's alternate numeric symbols if available. 



 Examples: 

 Convert seconds since the epoch (1970-01-01 UTC) to a date 

   $ date --date='@2147483647' 



 Show the time on the west coast of the US (use tzselect(1) to find TZ) 

   $ TZ='America/Los_Angeles' date 



 Show the local time for 9AM next Friday on the west coast of the US 

   $ date --date='TZ="America/Los_Angeles" 09:00 next Fri' 



 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 

 For complete documentation, run: info coreutils 'date invocation' 

 [root@marklin ~]# fdisk -h 

 Usage: 

  fdisk [options] <disk>    change partition table 

  fdisk [options] -l <disk> list partition table(s) 

  fdisk -s <partition>      give partition size(s) in blocks 



 Options: 

  -b <size>             sector size (512, 1024, 2048 or 4096) 

  -c[=<mode>]           compatible mode: 'dos' or 'nondos' (default) 

  -h                    print this help text 

  -u[=<unit>]           display units: 'cylinders' or 'sectors' (default) 

  -v                    print program version 

  -C <number>           specify the number of cylinders 

  -H <number>           specify the number of heads 

  -S <number>           specify the number of sectors per track 



 [root@marklin ~]#  



 man find: 



 关机命令: 

 shutdown  init  reboot poweroff 

 Lan:局域网 

 VXLAN:用在openstack 多个局域网 



 shutdown: 

 作用:关机,重启,定时关机 

 语法:shutdown [选项] 

 -r:=> 重启计算机 

 -h:=> 关机 

 -h+时间:=> 定时关机 



 shutdown -h :定时关机  

 shutdown -h+10:10分钟之后关机 

 shutdown -h 时间:指定具体的时间定时关机 

 shutdown -h now:立即关机 

 shutdown -c : 取消定时关机 



 rhel 7个系统启动级别: 



 init 命令: 

 作用:切换系统运行级别 

 语法:init 0-6 

 7个系统启动级别: 

 0:系统停机模式,系统默认运行级别不能设置为0,否则不能正常启动,机器关闭 

 1:单用户模式,root权限。用于系统维护,禁止远程登录,就像Windows下的安全模式登录 

 2:多用户模式,没有nfs网络支持 

 3:完整的多用户模式:有nfs,登录只够进入控制命令行模式 

 4.系统未使用,保留一般不用,在特殊情况下用它来做一些事情 

 5:图形化模式,登陆之后进入图形化GUI模式 

 6:重启模式,默认级别不能设置为6,否则不能正常启动,运行init 6 机器就会重启 





 RHEL 6: 

 [root@marklin ~]# init 0 

 [root@marklin ~]# init 3 

 [root@marklin ~]# init 5 



 RHEL 7 不再使用etc/inittab 文件进行默认的启动级别配置 

 systemd使用比sysvinit的运行级别更为自由的target替代 

 第3级运行使用 multi-user.target替代 

 第4级运行使用 graphical.target替代 

 runlevel3.target 和runlevel5.target分别是 multi-user.target和graphical.target的符号连接 



 [root@marklin ~]#vim etc/inittab 



 运行第三级别: 

 [root@marklin ~]#systemctl isolate  multi-user.target 

 或者: 

 [root@marklin ~]#systemctl isolate  runlevel3.target 



 运行第五级别: 

 [root@marklin ~]#systemctl isolate  graphical.target 

 或者: 

 [root@marklin ~]#systemctl isolate  runlevel5.target 



 默认第三级别: 

 [root@marklin ~]#systemctl  set-default multi-user.target 



 默认第五级别: 

 [root@marklin ~]#systemctl  set-default graphical.target 



 查看默认启动级别: 

 [root@marklin ~]#systemctl  get-default 



 runlevel:运行启动级别