linux常用命令

Posted

tags:

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

  1. 防火墙操作

  2. ip地址操作

  3. 文件操作

  4. redis安装和简单配置

查看网络信息

ifconfig

 contos7

1.防火墙

临时关闭防火墙

systemctl stop firewalld

 

永久防火墙开机关闭

systemctl disable firewalld

 

临时打开防火墙

systemctl start firewalld

 

防火墙开机启动

systemctl enable firewalld

 

查看防火墙状态

systemctl status firewalld

 

2.SElinux

  临时关闭SElinux

  setenforce 0

 

  临时打开SElinux

  setenforce 1

 

  开机关闭SElinux

  编辑 /etc/selinux/config文件,将SELINUX的值设置为disabled

 

 

三、文件操作

查看文件  cat

编辑文件 vim

复制 cp  -r

移动 mv

新建文件 touch

新建文件夹 mkdir

四、redis 安装和简单配置

 

wget http://download.redis.io/releases/redis-3.0.6.tar.gz   #可能是国外源下载不下来
#下载完成
tar xzf redis-3.0.6.tar.gz
cd redis-3.0.6
make   #编辑

启动服务端

src/redis-server

启动客户端

src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

当外面主机来连接可能出现

edis.exceptions.ResponseError: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command ‘CONFIG SET protected-mode no‘ from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to ‘no‘, and then restarting the server. 3) If you started the server manually just for testing, restart it with the ‘--protected-mode no‘ option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

 

配置下redis-table 下面的redis.conf文件

将下面两个配置改为:

bind 0.0.0.0  #所有主机都可以连接

protected-mode no     #不是保护模式

再次启动redis服务

 

src/redis-server redis.conf  

 


以上是关于linux常用命令的主要内容,如果未能解决你的问题,请参考以下文章

linux中怎么查看mysql数据库版本

Linux常用文件管理命令

markdown [Docker] Docker片段列表和命令#linux #docker #snippets

Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段

C#常用代码片段备忘

常用python日期日志获取内容循环的代码片段