常用Linux指令

  • 解压windows下压缩的zip文件(中文乱码)
# ArchLinux 需要安装 unzip-iconv
unzip -O cp936 demo.zip
  • 解决阿里云服务器断开
sudo vim /etc/ssh/sshd_config
# 在最后加上
ClientAliveInterval 30
ClientAliveCountMax 86400
# 每30秒发一次心跳
# 客户端86400s没有响应, 断开连接

# 修改端口号也在此文件中

sudo service sshd restart
  • postgresql开启远程访问

    1. 配置文件都位于 /etc/postgresql/10/main
    2. 修改postgresql.conf ,listen_addresses = '*'
    3. 修改pg_hba.conf , host all all 0.0.0.0/0 md5
    4. 重启postgresql服务
  • ubuntu 安装redis开启远程密码访问

    1. apt安装redis-server
    2. 修改 /etc/redis/redis.conf
    Port 端口号
    requirepass 需要密码
    daemonize yes 开启为守护进程
    # bind 127.0.0.1 注释掉
    
    1. service redis restart重启redis
  • postgresql psql

sudo -u postgres psql -d dmr_dev
sudo -u postgres psql
  • 新建postgresql数据库并指定owner
CREATE DATABASE yysg WITH OWNER = yysg
  • 授权数据库权限
GRANT ALL PRIVILEGES ON DATABASE dbname TO dbuser

你可能感兴趣的:(常用Linux指令)