Linux基础优化

Posted magicsimba

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux基础优化相关的知识,希望对你有一定的参考价值。

系统优化

关闭系统安全服务

iptables --Centos6防火墙

  • 临时关闭
    /etc/init.d/iptables stop /etc/init.d/iptables status services stop iptables
  • 永久关闭
    chkconfig iptables off chkconfig --list iptables

    firewalled --Centos7防火墙

  • 临时关闭
    systemctl stop firewalld systemctl is-active firewalld
  • 永久关闭
    systemctl disable firewalld systemctl is-enabled firewalld

    SELinux安全服务

  • 临时关闭
    setenforce setenforce 0 getenforce
  • 永久关闭
    • vim /etc/selinux/config
      替换第7行的enforcingdisabled
    • 或者直接输入命令执行
      sed -i ‘7s#enforcing#disabled#g‘ /etc/selinux/config

字符集优化

  • 临时调整
    • LANG="en_US.GBK"
  • 永久调整
    • vim /etc/profileLANG="en_US.GBK"写入
    • vim /etc/locale.confLANG="en_US.GBK"写入
    • localectl set-locale LANG="zh_CN.utf8"

系统时间信息优化

  • timedatectl命令
参数 含义
status 显示时间信息
set-time 00:00 设置时间为00:00
set-timezone ZONE 设置时区为ZONE
list-timezones 显示已知系统时区信息
set-local-rtc BOOL RTC功能是否开启
set-ntp BOOL 是否设置开启网络时间同步功能

RTC : 硬件时间信息,将系统信息自动同步给硬件
BOOL : 布尔型数据

远程连接优化

  • 直接通过替换命令修改
sed -i '79s#GSSAPIAuthentication yes#GSSAPIAuthentication no#g'  /etc/ssh/sshd_config
sed -i '115s#UseDNS yes#UseDNS no#g'  /etc/ssh/sshd_config
sed -i '/^#   StrictHostKeyChecking/c StrictHostKeyChecking no' /etc/ssh/ssh_config
systemctl restart sshd

颜色代码

颜色 代码 颜色 代码
开头 [33[01;3nm] 结尾 33[0m]
黑色 n=0 红色 n=1
绿色 n=2 黄色 n=3
蓝色 n=4 紫色 n=5
青色 n=6 白色 n=7

技术图片

以上是关于Linux基础优化的主要内容,如果未能解决你的问题,请参考以下文章

使用 C++ 反转句子中的每个单词需要对我的代码片段进行代码优化

如何优化C ++代码的以下片段 - 卷中的零交叉

20155201 李卓雯 《网络对抗技术》实验一 逆向及Bof基础

从JVM的角度看JAVA代码--代码优化

linux系统基础优化和安全重点小结

逆向及Bof基础实践