Linux之系统优化
查看系统版本
[root@luffy- /]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@luffy- /]# uname -m
x86_64
[root@luffy- /]# uname -r
2.6.-.el6.x86_64
[root@luffy- /]# uname -a
Linux luffy- 2.6.-.el6.x86_64 # SMP Tue Mar :: UTC x86_64 x86_64 x86_64 GNU/Linux
一般不使用 -a ,因为信息太长,不需要看这么多
系统环境变量PS1
查看系统环境变量 echo $PS1
#PS1 系统环境变量 ##一般都是大写的,在系统中任何的地方都可以使用。
[root@oldboyedu-01 ~]# echo $PS1 [\u@\h \W]\$
[root@oldboyedu-01 ~]# #\u=====当前用户名 whoami
[root@oldboyedu-01 ~]# #\h 当前主机名 hostname
[root@oldboyedu-01 ~]# #\W 当前的位置 pwd
[root@oldboyedu-01 ~]# PS1='[\u@\h \W \t]\$' 加了一个时间\t,就会在命令行前面显示时间
一、添加用户
Linux用户分为两种,root用户和普通用户
添加用户命令:useradd
查看用户:id
设置密码:passwd
切换用户:su - 用户名
思考:su 和su - 的区别是什么?
快捷键: ctrl + d 退出当前用户(控制着使用,一不小心按多了,就坏了)
二、关闭 SElinux
SELinux 主要由美国国家安全局开发
SElinux是限制root用户的权限的软件
临时关闭-重启服务器失效
[root@oldboyedu-01 ~]# #查询selinux状态
[root@oldboyedu-01 ~]# getenforce
Enforcing # 共3种状态 [root@oldboyedu-01 ~]# #enforcing selinux正在运行
[root@oldboyedu-01 ~]# #permissive selinux临时关闭 还是提示警告
[root@oldboyedu-01 ~]# #disabled selinux彻底关闭 #临时关闭 [root@oldboyedu-01 ~]# setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@oldboyedu-01 ~]# setenforce 0
[root@oldboyedu-01 ~]# getenforce
Permissive
[root@oldboyedu-01 ~]# 重启服务器,又会开启
永久关闭-重启服务器生效
需要使用vim修改/etc/selinux/config中的文件内容
[root@oldboyedu-01 ~]# vim /etc/selinux/config # 然后查看 [root@oldboyedu-01 ~]# grep "=disabled" /etc/selinux/config
SELINUX=disabled
[root@oldboyedu-01 ~]# grep "disabled" /etc/selinux/config
# disabled - No SELinux policy is loaded.
SELINUX=disabled
三、关闭Iptables
即关闭防火墙
临时关闭
# 查询防火墙是否在运行
/etc/init.d/iptables status
[root@oldboyedu-01 ~]# /etc/init.d/iptables stop 临时关闭iptables
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@oldboyedu-01 ~]# /etc/init.d/iptables stop
[root@oldboyedu-01 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
永久关闭
临时关闭后,开机还会自动启动
#如何让iptables在开机的时候 不自动启动
命令:chkconfig
# 数字3 的状态是on 就表示开机启动
[root@oldboyedu-01 ~]# chkconfig |grep ipt 检查iptables 是否开机启动
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@oldboyedu-01 ~]# chkconfig iptables off 关闭iptables的开机自启动
[root@oldboyedu-01 ~]# chkconfig |grep ipt
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
四、显示中文乱码的排查
1.什么是字符集?
######表示字符 文字的方法
UTF-8 万国码 系统默认的字符集
GBK GB2312
2.如何查看系统的字符集
[root@oldboyedu-01 ~]# echo $LANG
en_US.UTF-8
[root@oldboyedu-01 ~]# #语言.字符集
3.如何修改字符集-临时
[root@oldboyedu-01 ~]# export LANG=zh_CN.UTF-8
[root@oldboyedu-01 ~]# echo $LANG
zh_CN.UTF-8
4.如何修改字符集-永久
[root@oldboyedu-01 ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
5.生效
[root@oldboyedu-01 ~]# source /etc/sysconfig/i18n
[root@oldboyedu-01 ~]# echo $LANG
en_US.UTF-8
乱码之后如何排查
#####1.查看中文乱码的原因******
####1)linux使用的字符集 echo $LANG
####2)远程连接工具使用的字符集 即Xshell中的(单击小地球就会显示,或者在文件-属性-终端中(最下面)会有显示)
####1) 与 2) 不同 就会导致乱码 #####2.排查
####1)linux使用的字符集
####2)远程连接工具使用的字符集 #####3.解决
####方法1 修改远程连接工具字符集
####方法2 修改linux系统的字符集 ####1.如何修改字符集-临时
####2.如何修改字符集-永久
####3.生效
Linux之系统优化的更多相关文章
- Linux基础 - 系统优化及常用命令
目录 Linux基础系统优化及常用命令 Linux基础系统优化 网卡配置文件详解 ifup,ifdown命令 ifconfig命令 ifup,ifdown命令 ip命令 用户管理与文件权限篇 创建普通 ...
- Linux基础系统优化及常用命令
# Linux基础系统优化及常用命令 [TOC] ## Linux基础系统优化 Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. - ...
- Linux基本系统优化
Linux基本系统优化 Linux Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令, 在配置服务器基础环境时,先了解下网络参数设定命令. ifconfig 查询.设置网卡和ip等参 ...
- Linux操作系统优化
figure:first-child { margin-top: -20px; } #write ol, #write ul { position: relative; } img { max-wid ...
- s5-6 Linux 标准输出 系统优化 目录结构
标准输出 重定向符号 #> 1> 标准输出重定向 先把文件的内容清空 把内容放在文件的最后一行 #>> 1>> 追加重定向 把内容放 ...
- Linux之系统优化配置
Linux系统优化配置 更新国内镜像源 国内速度快的常用更新源如下: http://mirrors.sohu.com http://mirrors.163.com [root@greymous ...
- Linux基础系统优化
Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. ifconfig 查询.设置网卡和ip等参数 ifup,ifdown 脚本命 ...
- linux centos6 系统优化脚本-经典
转载一篇Ricky的系统优化脚本,这个脚本只能针对centos6x 其他还没有测试,但centos7肯定不行的 #!/bin/bash # ID 201510192126 # Author Ricky ...
- Linux基础系统优化(二)
SELinux功能 SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,这个功能管理员又爱又恨,大多数生产环境也是关闭的做法,安全手段使 ...
随机推荐
- es6 语法 (函数扩展)
//函数参数默认值(more值后不能有参数) { function test(x,y = 'world'){ console.log('默认值',x,y); } test('hello');// he ...
- .net core 下编码问题
System.Globalization.CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("zh-CN&q ...
- JVM调优(二)经验参数设置
调优设置具体解析 堆大小设置 JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制:系统的可用虚拟内存限制:系统的可用物理内存限制.32位系统下,一般限制在1.5 ...
- RobotFramework RobotFramework官方demo Quick Start Guide浅析
RobotFramework官方demo Quick Start Guide浅析 by:授客 QQ:1033553122 博客:http://blog.sina.com.cn/ishouk ...
- Android为TV端助力 很详细的序列化过程Parcelable
直接上代码:注释都写的很清楚了. public class Entry implements Parcelable{ public int userID; public String username ...
- Android性能优化问题总结
性能优化这块,分为UI性能优化.内存优化.数据库优化.网络优化.耗电优化等等.可以从1.如何发现问题,2.怎么解决问题,3.解决效果对比,这几个方面去描述.举个简单例子——UI优化,可以从 UI出现什 ...
- git 代码服务器的网页版gitweb的搭建
sudo apt-get install apache2 git-core gitwebsudo a2enmod rewrite #vi /etc/gitweb.conf $projectroot = ...
- 关于bug的一些思考
上午看了两道算法,自己编译器上面敲了一遍,然后又去网站上敲了一遍: 编译器上面无论哦如何都调不出来,网站上面也是: 吃个午饭,睡个觉,醒来重新手撸了一遍,然后就过了 : 面对这种事情,真的是自己应该多 ...
- Struts2之action 之 感叹号 ! 动态方法调用
struts2的动态方法调用的方式: 1.第一种方式:设置method属性 在Action类中定义一个签名与execute方法相同.只是名字不同的方法,如定义为: public String logi ...
- wifi破解基础及工具的使用
cdlinux学习,WiFi破解 cdlinux下载.vm安装 cdlinux下载 密码:vxao - 注意:cdlinux必须是在连接网卡的情况下,才能使用 水滴的使用 抓包.跑包 选择信号强度高, ...