[root@localhost ~]# rpm -qa|grep bash bash-4.2.46-28.el7.x86_64 [root@localhost ~]# rpm -qf /bin/bash bash-4.2.46-28.el7.x86_64 [root@localhost ~]# rpm -qg bash group bash does not contain any packages [root@localhost ~]# rpm -q --whatprovides /bin/bash bash-4.2.46-28.el7.x86_64 [root@localhost ~]# rpm -q --whatrequires /bin/bash nss-softokn-freebl-3.28.3-6.el7.x86_64 iproute-3.10.0-87.el7.x86_64 grubby-8.28-23.el7.x86_64 openssl-1.0.2k-8.el7.x86_64 rpm-4.11.3-25.el7.x86_64 openldap-2.4.44-5.el7.x86_64 policycoreutils-2.5-17.1.el7.x86_64 teamd-1.25-5.el7.x86_64 device-mapper-1.02.140-8.el7.x86_64 dracut-033-502.el7.x86_64 kmod-20-15.el7.x86_64 systemd-219-42.el7.x86_64 initscripts-9.49.39-1.el7.x86_64 crontabs-1.11-6.20121102git.el7.noarch dhclient-4.2.5-58.el7.centos.x86_64 dracut-network-033-502.el7.x86_64 ebtables-2.0.10-15.el7.x86_64 plymouth-scripts-0.8.9-0.28.20140113.el7.centos.x86_64 firewalld-0.4.4.4-6.el7.noarch kexec-tools-2.0.14-17.el7.x86_64 audit-2.7.6-3.el7.x86_64 postfix-2.10.1-6.el7.x86_64 openssh-server-7.4p1-11.el7.x86_64 dracut-config-rescue-033-502.el7.x86_64 iprutils-2.4.14.1-1.el7.x86_64 man-db-2.6.3-9.el7.x86_64 selinux-policy-targeted-3.13.1-166.el7.noarch [root@localhost ~]# rpm -q --changelog bash|head -3 * Tue Mar 07 2017 Kamil Dudka <kdudka@redhat.com - 4.2.46-28 - CVE-2016-9401 - Fix crash when '-' is passed as second sign to popd Resolves: #1429838 [root@localhost ~]# rpm -ql bash /etc/skel/.bash_logout /etc/skel/.bash_profile /etc/skel/.bashrc /usr/bin/alias /usr/bin/bash /usr/bin/bashbug /usr/bin/bashbug-64 /usr/bin/bg /usr/bin/cd /usr/bin/command /usr/bin/fc /usr/bin/fg /usr/bin/getopts /usr/bin/jobs /usr/bin/read /usr/bin/sh /usr/bin/umask /usr/bin/unalias /usr/bin/wait /usr/share/doc/bash-4.2.46 /usr/share/doc/bash-4.2.46/COPYING /usr/share/info/bash.info.gz /usr/share/locale/af/LC_MESSAGES/bash.mo /usr/share/locale/bg/LC_MESSAGES/bash.mo /usr/share/locale/ca/LC_MESSAGES/bash.mo /usr/share/locale/cs/LC_MESSAGES/bash.mo /usr/share/locale/de/LC_MESSAGES/bash.mo /usr/share/locale/en@boldquot/LC_MESSAGES/bash.mo /usr/share/locale/en@quot/LC_MESSAGES/bash.mo /usr/share/locale/eo/LC_MESSAGES/bash.mo /usr/share/locale/es/LC_MESSAGES/bash.mo /usr/share/locale/et/LC_MESSAGES/bash.mo /usr/share/locale/fi/LC_MESSAGES/bash.mo /usr/share/locale/fr/LC_MESSAGES/bash.mo /usr/share/locale/ga/LC_MESSAGES/bash.mo /usr/share/locale/hu/LC_MESSAGES/bash.mo /usr/share/locale/id/LC_MESSAGES/bash.mo /usr/share/locale/ja/LC_MESSAGES/bash.mo /usr/share/locale/lt/LC_MESSAGES/bash.mo /usr/share/locale/nl/LC_MESSAGES/bash.mo /usr/share/locale/pl/LC_MESSAGES/bash.mo /usr/share/locale/pt_BR/LC_MESSAGES/bash.mo /usr/share/locale/ro/LC_MESSAGES/bash.mo /usr/share/locale/ru/LC_MESSAGES/bash.mo /usr/share/locale/sk/LC_MESSAGES/bash.mo /usr/share/locale/sv/LC_MESSAGES/bash.mo /usr/share/locale/tr/LC_MESSAGES/bash.mo /usr/share/locale/uk/LC_MESSAGES/bash.mo /usr/share/locale/vi/LC_MESSAGES/bash.mo /usr/share/locale/zh_CN/LC_MESSAGES/bash.mo /usr/share/locale/zh_TW/LC_MESSAGES/bash.mo /usr/share/man/man1/..1.gz /usr/share/man/man1/:.1.gz /usr/share/man/man1/[.1.gz /usr/share/man/man1/alias.1.gz /usr/share/man/man1/bash.1.gz /usr/share/man/man1/bashbug-64.1.gz /usr/share/man/man1/bashbug.1.gz /usr/share/man/man1/bg.1.gz /usr/share/man/man1/bind.1.gz /usr/share/man/man1/break.1.gz /usr/share/man/man1/builtin.1.gz /usr/share/man/man1/builtins.1.gz /usr/share/man/man1/caller.1.gz /usr/share/man/man1/cd.1.gz /usr/share/man/man1/command.1.gz /usr/share/man/man1/compgen.1.gz /usr/share/man/man1/complete.1.gz /usr/share/man/man1/compopt.1.gz /usr/share/man/man1/continue.1.gz /usr/share/man/man1/declare.1.gz /usr/share/man/man1/dirs.1.gz /usr/share/man/man1/disown.1.gz /usr/share/man/man1/enable.1.gz /usr/share/man/man1/eval.1.gz /usr/share/man/man1/exec.1.gz /usr/share/man/man1/exit.1.gz /usr/share/man/man1/export.1.gz /usr/share/man/man1/fc.1.gz /usr/share/man/man1/fg.1.gz /usr/share/man/man1/getopts.1.gz /usr/share/man/man1/hash.1.gz /usr/share/man/man1/help.1.gz /usr/share/man/man1/history.1.gz /usr/share/man/man1/jobs.1.gz /usr/share/man/man1/let.1.gz /usr/share/man/man1/local.1.gz /usr/share/man/man1/logout.1.gz /usr/share/man/man1/mapfile.1.gz /usr/share/man/man1/popd.1.gz /usr/share/man/man1/pushd.1.gz /usr/share/man/man1/read.1.gz /usr/share/man/man1/readonly.1.gz /usr/share/man/man1/return.1.gz /usr/share/man/man1/set.1.gz /usr/share/man/man1/sh.1.gz /usr/share/man/man1/shift.1.gz /usr/share/man/man1/shopt.1.gz /usr/share/man/man1/source.1.gz /usr/share/man/man1/suspend.1.gz /usr/share/man/man1/times.1.gz /usr/share/man/man1/trap.1.gz /usr/share/man/man1/type.1.gz /usr/share/man/man1/typeset.1.gz /usr/share/man/man1/ulimit.1.gz /usr/share/man/man1/umask.1.gz /usr/share/man/man1/unalias.1.gz /usr/share/man/man1/unset.1.gz /usr/share/man/man1/wait.1.gz [root@localhost ~]# rpm -qi bash Name : bash Version : 4.2.46 Release : 28.el7 Architecture: x86_64 Install Date: Wed 09 May 2018 10:53:47 PM CST Group : System Environment/Shells Size : 3663637 License : GPLv3+ Signature : RSA/SHA256, Thu 10 Aug 2017 11:03:40 PM CST, Key ID 24c6a8a7f4a80e b5 Source RPM : bash-4.2.46-28.el7.src.rpm Build Date : Thu 03 Aug 2017 05:13:21 AM CST Build Host : c1bm.rdu2.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.gnu.org/software/bash Summary : The GNU Bourne Again shell Description : The GNU Bourne Again shell (Bash) is a shell or command language interpreter that is compatible with the Bourne shell (sh). Bash incorporates useful features from the Korn shell (ksh) and the C shell (csh). Most sh scripts can be run by bash without modification. [root@localhost ~]# rpm -qc bash /etc/skel/.bash_logout /etc/skel/.bash_profile /etc/skel/.bashrc [root@localhost ~]# rpm -qd bash /usr/share/doc/bash-4.2.46/COPYING /usr/share/info/bash.info.gz /usr/share/man/man1/..1.gz /usr/share/man/man1/:.1.gz /usr/share/man/man1/[.1.gz /usr/share/man/man1/alias.1.gz /usr/share/man/man1/bash.1.gz /usr/share/man/man1/bashbug-64.1.gz /usr/share/man/man1/bashbug.1.gz /usr/share/man/man1/bg.1.gz /usr/share/man/man1/bind.1.gz /usr/share/man/man1/break.1.gz /usr/share/man/man1/builtin.1.gz /usr/share/man/man1/builtins.1.gz /usr/share/man/man1/caller.1.gz /usr/share/man/man1/cd.1.gz /usr/share/man/man1/command.1.gz /usr/share/man/man1/compgen.1.gz /usr/share/man/man1/complete.1.gz /usr/share/man/man1/compopt.1.gz /usr/share/man/man1/continue.1.gz /usr/share/man/man1/declare.1.gz /usr/share/man/man1/dirs.1.gz /usr/share/man/man1/disown.1.gz /usr/share/man/man1/enable.1.gz /usr/share/man/man1/eval.1.gz /usr/share/man/man1/exec.1.gz /usr/share/man/man1/exit.1.gz /usr/share/man/man1/export.1.gz /usr/share/man/man1/fc.1.gz /usr/share/man/man1/fg.1.gz /usr/share/man/man1/getopts.1.gz /usr/share/man/man1/hash.1.gz /usr/share/man/man1/help.1.gz /usr/share/man/man1/history.1.gz /usr/share/man/man1/jobs.1.gz /usr/share/man/man1/let.1.gz /usr/share/man/man1/local.1.gz /usr/share/man/man1/logout.1.gz /usr/share/man/man1/mapfile.1.gz /usr/share/man/man1/popd.1.gz /usr/share/man/man1/pushd.1.gz /usr/share/man/man1/read.1.gz /usr/share/man/man1/readonly.1.gz /usr/share/man/man1/return.1.gz /usr/share/man/man1/set.1.gz /usr/share/man/man1/sh.1.gz /usr/share/man/man1/shift.1.gz /usr/share/man/man1/shopt.1.gz /usr/share/man/man1/source.1.gz /usr/share/man/man1/suspend.1.gz /usr/share/man/man1/times.1.gz /usr/share/man/man1/trap.1.gz /usr/share/man/man1/type.1.gz /usr/share/man/man1/typeset.1.gz /usr/share/man/man1/ulimit.1.gz /usr/share/man/man1/umask.1.gz /usr/share/man/man1/unalias.1.gz /usr/share/man/man1/unset.1.gz /usr/share/man/man1/wait.1.gz [root@localhost ~]# rpm -q --provides bash /bin/bash /bin/sh bash = 4.2.46-28.el7 bash(x86-64) = 4.2.46-28.el7 config(bash) = 4.2.46-28.el7 [root@localhost ~]# rpm -qR bash /bin/sh config(bash) = 4.2.46-28.el7 libc.so.6()(64bit) libc.so.6(GLIBC_2.11)(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.8)(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) libtinfo.so.5()(64bit) rpmlib(BuiltinLuaScripts) <= 4.2.2-1 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rtld(GNU_HASH) rpmlib(PayloadIsXz) <= 5.2-1 [root@localhost ~]# rpm -q --scripts bash postinstall scriptlet (using <lua>): nl = '\n' sh = '/bin/sh'..nl bash = '/bin/bash'..nl f = io.open('/etc/shells', 'a+') if f then local shells = nl..f:read('*all')..nl if not shells:find(nl..sh) then f:write(sh) end if not shells:find(nl..bash) then f:write(bash) end f:close() end postuninstall scriptlet (using <lua>): -- Run it only if we are uninstalling if arg[2] == "0" then t={} for line in io.lines("/etc/shells") do if line ~= "/bin/bash" and line ~= "/bin/sh" then table.insert(t,line) end end f = io.open("/etc/shells", "w+") for n,line in pairs(t) do f:write(line.."\n") end f:close() end
[root@localhost ~]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirror01.idc.hinet.net * extras: mirrors.cn99.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base 9,911 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,581 extras/7/x86_64 CentOS-7 - Extras 305 updates/7/x86_64 CentOS-7 - Updates 654 [root@localhost ~]# yum list installed|head Loaded plugins: fastestmirror Installed Packages GeoIP.x86_64 1.5.0-11.el7 @anaconda NetworkManager.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-libnm.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-team.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-tui.x86_64 1:1.8.0-9.el7 @anaconda NetworkManager-wifi.x86_64 1:1.8.0-9.el7 @anaconda acl.x86_64 2.2.51-12.el7 @anaconda aic94xx-firmware.noarch 30-6.el7 @anaconda [root@localhost ~]# yum check-update kernel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirror01.idc.hinet.net * extras: mirrors.cn99.com * updates: mirrors.aliyun.com kernel.x86_64 3.10.0-862.3.2.el7 updates [root@localhost ~]# yum provides bash Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirror01.idc.hinet.net * extras: mirrors.cn99.com * updates: mirrors.aliyun.com bash-4.2.46-30.el7.x86_64 : The GNU Bourne Again shell Repo : base bash-4.2.46-28.el7.x86_64 : The GNU Bourne Again shell Repo : @anaconda [root@localhost ~]# yum grouplist Loaded plugins: fastestmirror There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirror01.idc.hinet.net * extras: mirrors.cn99.com * updates: mirrors.aliyun.com Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Cinnamon Desktop MATE Desktop Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Educational Software Electronic Lab Fedora Packager General Purpose Desktop Graphical Administration Tools Haskell Legacy UNIX Compatibility Milkymist Scientific Support Security Tools Smart Card Support System Administration Tools System Management TurboGears application framework Xfce Done
--noplugins 禁用全部插件php
$YUM0-9node
[root@localhost ~]# yum -y install wget Loaded plugins: fastestmirror base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 (1/4): base/7/x86_64/primary_db | 5.9 MB 00:09 (2/4): extras/7/x86_64/primary_db | 147 kB 00:09 (3/4): base/7/x86_64/group_gz | 166 kB 00:09 (4/4): updates/7/x86_64/primary_db | 2.0 MB 00:11 Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-15.el7_4.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: wget x86_64 1.14-15.el7_4.1 base 547 k Transaction Summary ================================================================================ Install 1 Package Total download size: 547 k Installed size: 2.0 M Downloading packages: wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-15.el7_4.1.x86_64 1/1 Verifying : wget-1.14-15.el7_4.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-15.el7_4.1 Complete! [root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2018-06-12 09:36:44-- http://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 183.60.159.232, 183.60.159.227, 202.105.176.237, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|183.60.159.232|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2573 (2.5K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’ 100%[======================================>] 2,573 --.-K/s in 0.003s 2018-06-12 09:36:44 (727 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2573/2573] [root@localhost yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Base.repo.bak CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo --2018-06-12 09:37:33-- http://mirrors.aliyun.com/repo/epel-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 202.105.176.227, 202.105.176.237, 202.105.176.236, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|202.105.176.227|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 664 [application/octet-stream] Saving to: ‘/etc/yum.repos.d/epel.repo’ 100%[======================================>] 664 --.-K/s in 0s 2018-06-12 09:37:33 (52.0 MB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664] [root@localhost yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Base.repo.bak CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo epel.repo [root@localhost yum.repos.d]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base epel extras updates Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors [root@localhost yum.repos.d]# yum makecache Loaded plugins: fastestmirror base | 3.6 kB 00:00 epel | 3.2 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 (1/18): epel/x86_64/group_gz | 88 kB 00:00 (2/18): base/7/x86_64/group_gz | 166 kB 00:00 (3/18): epel/x86_64/updateinfo | 932 kB 00:04 (4/18): epel/x86_64/prestodelta | 1.4 kB 00:00 (5/18): epel/x86_64/primary | 3.5 MB 00:17 (6/18): base/7/x86_64/primary_db | 5.9 MB 00:23 (7/18): epel/x86_64/other | 2.2 MB 00:06 base/7/x86_64/filelists_db FAILED http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/f35d0029ad59e9fca0823be708150f5ee28ee1707cdc9bdaf420da676daafe28-filelists.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/f35d0029ad59e9fca0823be708150f5ee28ee1707cdc9bdaf420da676daafe28-filelists.sqlite.bz2: (28, 'Connection timed out after 30000 milliseconds') Trying other mirror. base/7/x86_64/other_db FAILED http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ede157be4cf5c030483ab639f8f18c6daf268d4c233037a1578b3ed8258fa461-other.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ede157be4cf5c030483ab639f8f18c6daf268d4c233037a1578b3ed8258fa461-other.sqlite.bz2: (28, 'Connection timed out after 30001 milliseconds') Trying other mirror. (8/18): extras/7/x86_64/other_db | 95 kB 00:00 (9/18): extras/7/x86_64/primary_db | 147 kB 00:00 (10/18): updates/7/x86_64/prestodelta | 237 kB 00:01 (11/18): epel/x86_64/filelists | 10 MB 00:34 (12/18): updates/7/x86_64/filelists_db | 1.3 MB 00:05 (13/18): updates/7/x86_64/other_db | 231 kB 00:00 (14/18): updates/7/x86_64/primary_db | 2.0 MB 00:08 (15/18): base/7/x86_64/other_db | 2.5 MB 00:10 (16/18): base/7/x86_64/filelists_db | 6.9 MB 00:14 extras/7/x86_64/filelists_db FAILED http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/cd697d6a6d62dc517544660b2165ab5c5e89e0dfd9205078ae57f341dcb7856d-filelists.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/cd697d6a6d62dc517544660b2165ab5c5e89e0dfd9205078ae57f341dcb7856d-filelists.sqlite.bz2: (28, 'Connection timed out after 30003 milliseconds') Trying other mirror. (17/18): extras/7/x86_64/filelists_db | 519 kB 00:00 extras/7/x86_64/prestodelta FAILED http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/bd200a0ecb76986b2a6667904f4918b717594faa19e66adcc57ec50af853aa4e-prestodelta.xml.gz: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/bd200a0ecb76986b2a6667904f4918b717594faa19e66adcc57ec50af853aa4e-prestodelta.xml.gz: (28, 'Connection timed out after 30003 milliseconds') Trying other mirror. (18/18): extras/7/x86_64/prestodelta | 48 kB 00:00 Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com epel 12581/12581 epel 12581/12581 epel 12581/12581 Metadata Cache Created [root@localhost yum.repos.d]# yum repo list Loaded plugins: fastestmirror No such command: repo. Please use /usr/bin/yum --help [root@localhost yum.repos.d]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,911 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,581 extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 305 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 654 repolist: 23,451
[root@localhost ~]# mount -r /dev/sr0 /media/cdrom/ [root@localhost ~]# ls /media/cdrom/ CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7 EFI images Packages RPM-GPG-KEY-CentOS-Testing-7 EULA isolinux repodata TRANS.TBL [root@localhost ~]# vim /etc/yum.repos.d/local.repo [root@localhost ~]# cat /etc/yum.repos.d/local.repo [local] name=Local Packages for Enterprise Linux 7 baseurl=file:///media/cdrom gpgcheck=0 [root@localhost ~]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,911 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,581 extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 305 local Local Packages for Enterprise Linux 7 3,894 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 654 repolist: 27,345
[root@localhost scripts]# vim echoAt.sh [root@localhost scripts]# cat echoAt.sh #!/bin/bash echo "hello world" [root@localhost scripts]# at -f /root/scripts/echoAt.sh now+1min job 2 at Sat Jun 9 11:46:00 2018 [root@localhost scripts]# at -l 2 Sat Jun 9 11:46:00 2018 a root [root@localhost scripts]# at -l 2 Sat Jun 9 11:46:00 2018 a root [root@localhost scripts]# at -l [root@localhost scripts]# mail Heirloom Mail version 12.5 7/5/10. Type ? for help. "/var/spool/mail/root": 1 message 1 new >N 1 root Sat Jun 9 11:46 14/505 "Output from your job " & 1 Message 1: From root@localhost.localdomain Sat Jun 9 11:46:00 2018 Return-Path: <root@localhost.localdomain> X-Original-To: root Delivered-To: root@localhost.localdomain Subject: Output from your job 2 To: root@localhost.localdomain Date: Sat, 9 Jun 2018 11:46:00 +0800 (CST) From: root@localhost.localdomain (root) Status: R hello world & q Held 1 message in /var/spool/mail/root You have mail in /var/spool/mail/root [root@localhost scripts]# at -f /root/scripts/echoAt.sh now+1min job 4 at Sat Jun 9 11:49:00 2018 [root@localhost scripts]# at -l 4 Sat Jun 9 11:49:00 2018 a root [root@localhost scripts]# at -d 4 [root@localhost scripts]# at -l [root@localhost scripts]# at -f /root/scripts/echoAt.sh now+1min job 5 at Sat Jun 9 11:49:00 2018 [root@localhost scripts]# at -c 5 #!/bin/sh # atrun uid=0 gid=0 # mail root 0 umask 22 XDG_SESSION_ID=1; export XDG_SESSION_ID HOSTNAME=localhost.localdomain; export HOSTNAME SHELL=/bin/bash; export SHELL HISTSIZE=1000; export HISTSIZE SSH_CLIENT=192.168.1.103\ 53797\ 22; export SSH_CLIENT SSH_TTY=/dev/pts/0; export SSH_TTY USER=root; export USER LS_COLORS=rs=0:di=01\;34:ln=01\;36:mh=00:pi=40\;33:so=01\;35:do=01\;35:bd=40\;33\;01:cd=40\;33\;01:or=40\;31\;01:mi=01\;05\;37\;41:su=37\;41:sg=30\;43:ca=30\;41:tw=30\;42:ow=34\;42:st=37\;44:ex=01\;32:\*.tar=01\;31:\*.tgz=01\;31:\*.arc=01\;31:\*.arj=01\;31:\*.taz=01\;31:\*.lha=01\;31:\*.lz4=01\;31:\*.lzh=01\;31:\*.lzma=01\;31:\*.tlz=01\;31:\*.txz=01\;31:\*.tzo=01\;31:\*.t7z=01\;31:\*.zip=01\;31:\*.z=01\;31:\*.Z=01\;31:\*.dz=01\;31:\*.gz=01\;31:\*.lrz=01\;31:\*.lz=01\;31:\*.lzo=01\;31:\*.xz=01\;31:\*.bz2=01\;31:\*.bz=01\;31:\*.tbz=01\;31:\*.tbz2=01\;31:\*.tz=01\;31:\*.deb=01\;31:\*.rpm=01\;31:\*.jar=01\;31:\*.war=01\;31:\*.ear=01\;31:\*.sar=01\;31:\*.rar=01\;31:\*.alz=01\;31:\*.ace=01\;31:\*.zoo=01\;31:\*.cpio=01\;31:\*.7z=01\;31:\*.rz=01\;31:\*.cab=01\;31:\*.jpg=01\;35:\*.jpeg=01\;35:\*.gif=01\;35:\*.bmp=01\;35:\*.pbm=01\;35:\*.pgm=01\;35:\*.ppm=01\;35:\*.tga=01\;35:\*.xbm=01\;35:\*.xpm=01\;35:\*.tif=01\;35:\*.tiff=01\;35:\*.png=01\;35:\*.svg=01\;35:\*.svgz=01\;35:\*.mng=01\;35:\*.pcx=01\;35:\*.mov=01\;35:\*.mpg=01\;35:\*.mpeg=01\;35:\*.m2v=01\;35:\*.mkv=01\;35:\*.webm=01\;35:\*.ogm=01\;35:\*.mp4=01\;35:\*.m4v=01\;35:\*.mp4v=01\;35:\*.vob=01\;35:\*.qt=01\;35:\*.nuv=01\;35:\*.wmv=01\;35:\*.asf=01\;35:\*.rm=01\;35:\*.rmvb=01\;35:\*.flc=01\;35:\*.avi=01\;35:\*.fli=01\;35:\*.flv=01\;35:\*.gl=01\;35:\*.dl=01\;35:\*.xcf=01\;35:\*.xwd=01\;35:\*.yuv=01\;35:\*.cgm=01\;35:\*.emf=01\;35:\*.axv=01\;35:\*.anx=01\;35:\*.ogv=01\;35:\*.ogx=01\;35:\*.aac=01\;36:\*.au=01\;36:\*.flac=01\;36:\*.mid=01\;36:\*.midi=01\;36:\*.mka=01\;36:\*.mp3=01\;36:\*.mpc=01\;36:\*.ogg=01\;36:\*.ra=01\;36:\*.wav=01\;36:\*.axa=01\;36:\*.oga=01\;36:\*.spx=01\;36:\*.xspf=01\;36:; export LS_COLORS MAIL=/var/spool/mail/root; export MAIL PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin; export PATH PWD=/root/scripts; export PWD LANG=en_US.UTF-8; export LANG HISTCONTROL=ignoredups; export HISTCONTROL SHLVL=1; export SHLVL HOME=/root; export HOME LOGNAME=root; export LOGNAME SSH_CONNECTION=192.168.1.103\ 53797\ 192.168.1.107\ 22; export SSH_CONNECTION LESSOPEN=\|\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN XDG_RUNTIME_DIR=/run/user/0; export XDG_RUNTIME_DIR OLDPWD=/root; export OLDPWD cd /root/scripts || { echo 'Execution directory inaccessible' >&2 exit 1 } ${SHELL:-/bin/sh} << 'marcinDELIMITER519a1011' #!/bin/bash echo "hello world" marcinDELIMITER519a1011
[root@localhost ~]# crontab -l * * * * * /bin/bash /root/a.sh * * * * * /bin/bash /root/b.sh [root@localhost ~]# cat a.sh . /etc/profile . ~/.bash_profile echo $PATH [root@localhost ~]# cat b.sh echo $PATH [root@localhost ~]# mail Heirloom Mail version 12.5 7/5/10. Type ? for help. "/var/spool/mail/root": 2 messages 2 new >N 1 (Cron Daemon) Sat Jun 9 12:26 25/861 "Cron <root@localhost>" N 2 (Cron Daemon) Sat Jun 9 12:26 25/897 "Cron <root@localhost>" & 1 Message 1: From root@localhost.localdomain Sat Jun 9 12:26:01 2018 Return-Path: <root@localhost.localdomain> X-Original-To: root Delivered-To: root@localhost.localdomain From: "(Cron Daemon)" <root@localhost.localdomain> To: root@localhost.localdomain Subject: Cron <root@localhost> /bin/bash /root/b.sh Content-Type: text/plain; charset=UTF-8 Auto-Submitted: auto-generated Precedence: bulk X-Cron-Env: <XDG_SESSION_ID=44> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0> X-Cron-Env: <LANG=en_US.UTF-8> X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/root> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=root> X-Cron-Env: <USER=root> Date: Sat, 9 Jun 2018 12:26:01 +0800 (CST) Status: R /usr/bin:/bin & 2 Message 2: From root@localhost.localdomain Sat Jun 9 12:26:01 2018 Return-Path: <root@localhost.localdomain> X-Original-To: root Delivered-To: root@localhost.localdomain From: "(Cron Daemon)" <root@localhost.localdomain> To: root@localhost.localdomain Subject: Cron <root@localhost> /bin/bash /root/a.sh Content-Type: text/plain; charset=UTF-8 Auto-Submitted: auto-generated Precedence: bulk X-Cron-Env: <XDG_SESSION_ID=45> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0> X-Cron-Env: <LANG=en_US.UTF-8> X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/root> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=root> X-Cron-Env: <USER=root> Date: Sat, 9 Jun 2018 12:26:01 +0800 (CST) Status: R /usr/local/sbin:/usr/sbin:/usr/bin:/bin:/root/bin & q Held 2 messages in /var/spool/mail/root
crontab -e 10 3,5 * * 3 /bin/bash /root/scripts/nowtime.sh vim /root/scripts/nowtime.sh #!/bin/bash # description: 輸出當前時間,時間格式爲 2017-12-28 10:00:00 . /etc/profile . ~/.bash_profile date +'%F %T'
sed 'script' filelinux
-i:編輯原文件git
[root@localhost ~]# cat /etc/fstab |sed -r -e 's/^#[[:space:]]*//g' -e '/^[[:space:]]*$/d' /etc/fstab Created by anaconda on Wed May 9 22:52:20 2018 Accessible filesystems, by reference, are maintained under '/dev/disk' See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info UUID=4f8f9662-22a0-446d-8044-465d2a00b42d / xfs defaults 0 0 UUID=2ffce847-9957-4a54-a48f-ff466fa8a6fa /boot xfs defaults 0 0 UUID=200259c9-e2bb-4768-a136-4e6f2d287686 swap swap defaults 0 0 [root@localhost ~]# sed '7s#disabled#enforcing#g' !$ sed '7s#disabled#enforcing#g' /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted