日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

9.28 linux系统基础优化

發布時間:2024/9/3 linux 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 9.28 linux系统基础优化 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
  • 關閉SELinux(是美國安全局對強制訪問的實現)功能
[root@wen ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #使用sed + i 命令修改 [root@wen ~]# grep "SELINUX=disabled" /etc/selinux/config #grep查看 SELINUX=disabled [root@wen ~]# 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 is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted 以上重啟生效,生產環境不能重啟用以下命令不用重啟  [root@wen ~]# getenforce Enforcing [root@wen ~]# setenforce usage: setenforce [ Enforcing | Permissive | 1 | 0 ] [root@wen ~]# setenforce 0 [root@wen ~]# getenforce Permissive
  • 運行級別
[root@wen ~]# cat /etc/inittab # inittab is only used by upstart for the default runlevel. # # ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # System initialization is started by /etc/init/rcS.conf # # Individual runlevels are started by /etc/init/rc.conf # # Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf # # Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf, # with configuration in /etc/sysconfig/init. # # For information on how to write upstart event handlers, or how # upstart works, see init(5), init(8), and initctl(8). # # Default runlevel. The runlevels used are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 #桌面 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault:[root@wen ~]# grep 3:initdefault /etc/inittab #調整運行級別,默認3,可以調成其他 id:3:initdefault: [root@wen ~]# runlevel #查看當前級別 N 3 [root@wen ~]# init 0 #切換運行級別 View Code
  • 關機
shutdown(halt) init0 參數 -r reboot after shutdown -h halt or power off after shutdown shutdown -h 10 #10分鐘后關閉 shutdown now #馬上 poweroff #關閉電源*關閉防火墻 [root@wen ~]# /etc/init.d/iptables stop #臨時關閉 iptables:將鏈設置為政策 ACCEPT:filter [確定] iptables:清除防火墻規則: [確定] iptables:正在卸載模塊: [確定] [root@wen ~]# /etc/init.d/iptables status #查看狀態 iptables:未運行防火墻。 [root@wen ~]# /etc/init.d/iptables restart # 重啟防火墻 iptables:應用防火墻規則: [確定] [root@wen ~]# chkconfig iptables off #開機也不啟動了
  • linux中文顯示設置等
*中文顯示設置 [root@wen ~]# echo 'LANG="zh_CN.UTF-8“‘ > /etc/sysconfig/i18n [root@wen ~]# cat /etc/sysconfig/i18n LANG="zh_CN.UTF-8“ [root@wen ~]# echo $LANG zh_CN.UTF-8 同時調整ssh客戶端*設置賬號超時時間 [root@wen ~]# export TMOUT=5 #5秒后關機 (臨時生效) [root@wen ~]# timed out waiting for input: auto-logout*設置命令行歷史記錄 [root@wen ~]# history -c #清除所有歷史記錄 [root@wen ~]# history #查看歷史記錄1 history [root@wen ~]# echo 1 1 [root@wen ~]# echo 2 2 [root@wen ~]# echo 3 3 [root@wen ~]# echo 4 4 [root@wen ~]# echo 5 5 [root@wen ~]# history -d 3 #刪除指定行記錄 [root@wen ~]# history1 history2 echo 13 echo 34 echo 45 echo 56 history -d 37 history [root@wen ~]# !6 #執行某行歷史命令 history -d 3[root@wen ~]# export HISTSIZE=5 #控制歷史記錄記錄數量(臨時生效)#永久生效放在/etc/profile文件下,然后source以下/etc/profile [root@wen ~]# history5 history6 echo7 history -d 38 export HISTSIZE=59 history [root@wen ~]# cat ~/.bash_history #即使控制了在根目錄下還有 [root@wen ~]# export HISTORYSIZE=5 #命令行命令對應文件的記錄數*隱藏版本信息 [root@wen ~]# cat /etc/issue CentOS release 6.7 (Final) Kernel \r on an \m[root@wen ~]# > /etc/issue [root@wen ~]# cat /etc/issue.net CentOS release 6.7 (Final) Kernel \r on an \m [root@wen ~]# >/etc/issue.net [root@wen ~]# cat /etc/issue [root@wen ~]#

總結

以上是生活随笔為你收集整理的9.28 linux系统基础优化的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。