文件权限
A. 更改文件权限 (chmod)
chmod 777 miao.in
默认文件为644,文件夹为755
TIP:
1st digit=Owner;
2nd=Group;
3rd=Other
(-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r–r-- = 644, etc.)
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied
高级命令
A. 查找. 常用命令
例子:找10MB以上的文件
find . -type f -size +10000k -exec ls -lh {} ; | awk ‘{ print $5 ": " $9 }’ |sort -n
B. Grep, 手里握着大西瓜 **
ls -alh | grep ooxx
只显示含有ooxx的那几列,当然你在cat的时候配合这个用找文件里的某些字段很方便
C. 分页 (Less/More)
less miao.php
如果源代码很长,则会分页显示,上下箭头滚动,输入q退出
tail -n 1000 /var/log/httpd/error_log | more
可以用 | more 参数来滚动显示页面或行
MYSQL 数据库
导出数据库
mysqldump -u 数据库用户名 -p 数据库名 > db_ooxx.sql
导出数据库为db_ooxx.sql
导入数据库
mysql -u 数据库用户名 -p 数据库名 < db_ooxx.sql --default-character-set=utf8
把当前目录的 db_ooxx.sql 以 utf8 编码导入,当然你原来是gbk就改成gbk
pip
安装好python后就可以安装pip
sudo apt-get install python-pip
可以在使用pip的时候,加上参数-i和镜像地址(如
https://pypi.tuna.tsinghua.edu.cn/simple),
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
,这样就会从清华镜像安装pandas库。
服务器常见问题
网络不通
可能带来各种更新失败
1.真的没联网 检查网线
2.使用校园网 需要准入+登陆
3.ping不通,ping外网IP可以:DNS服务出问题
vim /etc/resolv.conf
加入nameserber 8.8.8.8 或者 8.8.4.4
4.已联网但ping都不通 重启网路服务器试试
git command
初始化仓库:~/genunit/genunit$ git init
新建sshkey: ssh-keygen -t rsa -C “xxx@mail.com”
修改ssh方式: cd .git/config 改成 url = git@github.com:username/仓库名
加入修改:git add .
提交修改:git commit -m “first commit”
每天起床第一句: git pull origin
每天睡前最后一句:git push --set-upstream origin master
上述步骤配置好了服务器端的仓库和github上的私有仓库同步
日常使用:
- git pull https://github.com/
2.coding
3.git add .
4.git commit
5.git push -u origin master
sshkey 无密码ssh登陆服务器
- .ssh目录的权限必须是700
- .ssh/authorized_keys文件权限必须是600
https://www.kutu66.com//ubuntu/article_161842
ssh出现fingerprint异常处理方式(根据提示即可)
服务器配置jupyter步骤
- 安装jupyter
pip install jupyter
- 生成配置文件
jupyter notebook --generate-config
- 打开python,生成秘钥
from notebook.auth import passwd
passwd()
然后设置登录密码,生成秘钥,并复制你的秘钥
秘钥开头:sha1……
- 修改配置文件
vim ~/.jupyter/jupyter_notebook_config.py
在打开的文件中,找到以下4处,去掉注释,进行修改
其中,c.NotebookApp.ip=’*’ 是很多网上给的建议,但实际上替代为你的IP地址,就可以随时根据IP来登陆你的服务器了。
c.NotebookApp.ip='你的IP地址' # 就是多个用户使用ip地址访问
c.NotebookApp.password = u'sha:ce...' # 刚才复制的那个密文,密文一定不要写错,否则密码登不进去
c.NotebookApp.open_browser = False # 禁止自动打开浏览器
c.NotebookApp.port =8888 # 随便指定一个端口
- 在服务器端启动jupyter
nohup jupyter notebook
- 在远程连接的电脑上输入服务器ip:8888 就好了。(注意此时网站打开的文件夹位置就是你在服务器端启动jupyter的位置)