[杂记]关于Linux的一些记录

iptables 打开端口

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save

tar压缩

压缩data文件夹到data.tar.gz

tar -cvf data.tar.gz data

[Linux:关闭后SSH客户后,保存后台进程不被停止

nohup java -jar aa.jar &

Is there a web.py for python3 yet?

pip3 install git+https://github.com/webpy/webpy#egg=web.py

greenlet.error: cannot switch to a different thread

If you see this in the context of debugging using PyCharm, try this:
Go to Settings --> Build, Execution, Deployment -> Python Debugger. In that dialog, you'll see a "Gevent compatible" checkbox. Not sure how it got unticked in the new project.

root用户ssh可以登录,FileZilla sftp不能登录链接CentOS解决办法

把/etc/ssh/sshd_config文件中的
Subsystem sftp /usr/libexec/openssh/sftp-server改为Subsystem sftp internal-sftp

 vim /etc/ssh/sshd_config
# Subsystem      sftp    /usr/libexec/openssh/sftp-server
Subsystem       sftp    internal-sftp
#重新启动sshd即可使用root链接上sftp
service sshd reload

查看和修改Linux服务器的时区和时间

查看和修改Linux的时区

  • 查看当前时区
命令 : "date -R"
  • 修改设置Linux服务器时区
    方法 A
命令 : "tzselect"

方法 B 仅限于RedHat Linux 和 CentOS

命令 : "timeconfig"

方法 C 适用于Debian

命令 : "dpkg-reconfigure tzdata"
  • 复制相应的时区文件,替换系统时区文件;或者创建链接文件
cp /usr/share/zoneinfo/$主时区/$次时区 /etc/localtime
例如:在设置中国时区使用亚洲/上海(+8)
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

查看和修改Linux的时间

  • 查看时间和日期
命令 : "date"
  • 设置时间和日期
例如:将系统日期设定成2009年11月3日的命令
命令 : "date -s 11/03/2009"
  • 将系统时间设定成下午5点55分55秒的命令
命令 : "date -s 17:55:55"
date
显示当前时间 Fri Aug  3 14:15:16 CST 2007

date -s 
按字符串方式修改时间
可以只修改日期,不修改时间,输入: date -s 2007-08-03
只修改时间,输入:date -s 14:15:00
同时修改日期时间,注意要加双引号,日期与时间之间有一空格,输入:date -s "2007-08-03 14:15:00"

修改完后,需要的话可以输入:clock -w
把系统时间写入CMOS

  1. 将当前时间和日期写入BIOS,避免重启后失效
命令 : "hwclock -w"

查看系统版本

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64
[root@localhost ~]# rpm -q centos-release
centos-release-6-5.el6.centos.11.1.x86_64

你可能感兴趣的:([杂记]关于Linux的一些记录)