mongodb
清屏
cls
刪除指定數據表
db.COLLECTION_NAME.drop()
刪除指定數據庫
db.dropDatabase();
mongoDB的備份與還原
備份指定數據庫
mongodump -h 127.0.0.1 -d activity_spider -o /home/wen/Desktop/
####導出指定數據的某張表
mongoexport -d uxxxe -c userxxxns -o userxxxns.json
還原制定數據庫
# mongorestore -d activity_spider ~/activity_spider/
##啓動 mongodb
sudo service mongod start
關於mongo3.4 的一些shell
關於mongo3.6 的一些shell
文件本地/遠程傳輸
本地文件傳遠程
scp -r localfile.txt root@hostname:/home/username/
遠程文件傳本地
scp -r root@hostname:~/activityDemo.zip ~/Desktop/Node
##wind上傳到服務器
xshell上輸入
rz
sz //遠程傳本地
##刪除文件
單個文件
rm file.text
文件夾
rm -rf Node
##拷貝文件
cp -rf ~/xu/ ~/liu/
將~/xu目錄中的所有文件及其子目錄拷貝到目錄~/liu中。
##移動文件
把/photo/下的文件夾和文件剪切到/abc目錄下
mv ~/photo/* /abc
##創建文件
mkdir newFile
##重命名文件夾
mv oldname newname
##Python2x與3x版本切換
切換Python3爲默認版本:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
or
echo alias python=python3 >> ~/.bashrc
source ~/.bashrc
切換Python2爲默認版本:
sudo update-alternatives --config python
or
gedit ~/.bashrc
# alias python=python3
source ~/.bashrc
使用別名
alias python=python3
這樣就好啦
pip安裝
python2 安裝pip:
sudo apt-get install python-pip
peyton3 安裝pip3:
sudo apt-get install python3-pip
##檢查無用的軟件包
sudo apt-get autoremove
##安裝PM2
npm install pm2 -g
##ubuntu添加用戶
在 root用戶下添加
adduser aven
##將用戶添加到sudo組
usermod -a -G sudo aven