- Turn off SELinux (the U.S. Security Agency's implementation of mandatory access)
[Email protected] ~]# sed-i's#selinux=enforcing#selinux=disabled#g'/etc/selinux/config #使用sed +I command modify [[email protected]~]# grep"selinux=disabled"/etc/selinux/config #grep查看SELINUX=Disabled[[email protected]~]# cat/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 isenforced.# Permissive-SELinux Prints warnings instead of enforcing.# disabled-No SELinux Policy isloaded. SELINUX=disabled# Selinuxtype=Can take one of these values:# targeted-Targeted processes isprotected, # MLS-Multi level Security protection. Selinuxtype=targeted above reboot is in effect, production environment cannot be restarted for command without restarting [[email protected]~]# Getenforceenforcing[[email protected]~]# Setenforceusage:setenforce [Enforcing| Permissive |1|0][[email protected]~]# Setenforce0[[Email protected]~]# getenforcepermissive
[Email protected] ~]# cat/etc/inittab# Inittab isOnly used by upstart forThedefaultrunlevel.## ADDING Other CONFIGURATION here would have NO EFFECT on YOUR system.## SYSTEM initialization isStarted by/etc/init/rcs.conf## Individual runlevels is started by/etc/init/rc.conf## Ctrl-alt-delete isHandled by/etc/init/control-alt-delete.conf## Terminal Gettys is handled by/etc/init/tty.conf and/etc/init/serial.conf,# with configurationinch/etc/sysconfig/init.## for information on what to write upstartEventhandlers, or how# upstart works, see Init (5), Init (8), and Initctl (8). # # Default RunLevel. The runlevels used are:#0-Halt (Do notSetInitdefault to This)# 1-Single user mode#2-Multiuser, without NFS (the same as 3,ifYou DoNot having networking) #3-Full multiuser mode#4-unused#5-X11 #桌面 #6-Reboot (Do notSetInitdefault to This) # ID:3: Initdefault:[[email protected]~]# grep3: initdefault/etc/inittab #调整运行级别, default 3, can be adjusted to another ID:3: Initdefault:[[email protected]~]# runlevel #查看当前级别N3[[Email protected]~]# Init0#切换运行级别
View Code
shutdown (Halt) init0 parameters-R reboot after shutdown-h halt or power off after shutdown shutdown-HTen#10分钟后关闭shutdown now #马上poweroff #关闭电源*shut down the firewall [email protected]~]#/etc/init.d/iptables Stop #临时关闭iptables: Set the chain to policy accept:filter [OK]iptables: Clear firewall rule: [OK]iptables: Unloading module: [OK][[email protected]~]#/etc/init.d/iptables status #查看状态iptables: Firewall is not running. [[Email protected]~]#/etc/init.d/iptables Restart # Reboot firewall iptables: Apply firewall rule: [OK][[email prote CTED]~]# chkconfig iptables off #开机也不启动了
- Linux Chinese display settings, etc.
*Chinese display settings [[email protected]~]# Echo'lang= "ZH_CN. UTF-8 "' >/etc/sysconfig/i18n[Email protected] ~]# cat/etc/sysconfig/I18nlang="ZH_CN. UTF-8 "[[Email protected] ~]# Echo $LANGzh _cn. UTF-8simultaneous tuning of the SSH client*Set account timeout [[email protected]~]# Export tmout=5#5秒后关机 (Temporary entry into force) [[email protected]~]# timed outWaiting forinput:auto-Logout*set command line history [[email protected]~]# history-c #清除所有历史记录 [[email protected]~]# History #查看历史记录1History[[email protected]~]# Echo11[[Email protected]~]# Echo22[[Email protected]~]# Echo33[[Email protected]~]# Echo44[[Email protected]~]# Echo55[[Email protected]~]# history-d3#删除指定行记录 [[email protected]~]# History1 History2Echo1 3Echo3 4Echo4 5Echo5 6History-d3 7History[[email protected]~]# !6#执行某行历史命令History-D3[[Email protected]~]# Export histsize=5#控制历史记录记录数量 (temporarily in effect) #永久生效放在/etc/profile file, and then source the following/etc/Profile[[email protected]~]# History5 History6Echo7History-d3 8Export histsize=5 9History[[email protected]~]# Cat ~/. bash_history #即使控制了在根目录下还有 [[email protected]~]# Export historysize=5#命令行命令对应文件的记录数*Hide version info [email protected]~]# cat/etc/Issuecentos Release6.7(Final) Kernel \ r \m[[email protected]~]# >/etc/Issue[[email protected]~]# cat/etc/Issue.netcentos Release6.7(Final) Kernel \ r \m[[email protected]~]# >/etc/Issue.net[[email protected]~]# cat/etc/Issue[[email protected]~]#
9.28 Linux System Foundation optimization