(一)ubuntu常用的一些命令和踩過的坑

2021-09-21 14:34:29 字數 1650 閱讀 2123

ubuntu下python直譯器版本的切換

alias python=python3

預設python版本的設定

sudo update-alternatives --config python

然後鍵入版本前的序號即可完成預設版本的切換

python3下同時有python3.5和python3.6情況時:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2

1,2指優先順序:預設python3時,使用的是python3.5,我們可以改變優先順序,從而改變python的版本

pycharm報錯:failed to install packageing tools

錯誤表現:無法在settings—interpreter中看到改python直譯器下有哪些包。

原因:沒有安裝pip/pip3命令

解決方法:安裝pip或pip3命令,具體安裝哪乙個,看python版本。

命令:sudo apt install python-pip或pip3

錯誤:python2下無法使用pip或pip3

錯誤表現:

traceback (most recent call last):

file 「/home/ubuntu/.local/bin/pip」, line 7, in

from pip._internal import main

importerror: no module named _internal

解決辦法:強制重新安裝pip或pip3

命令(2行,依次執行):

sudo python3 get-pip.py --force-reinstall

伺服器相關操作

連線:ssh ghy@伺服器ip(如:1**.18.2**.*8)

往伺服器上upload檔案:scp -r 本地檔案路徑 ghy@伺服器ip:上傳到伺服器**(/home/ghy/)

斷開連線:exit

ubuntu開啟/關閉網路**(kingss)

sudo sslocal -c config.json -d start/stop

其中.json就是vpn的配置檔案,手動建立即可

與伺服器之間的檔案掛載

伺服器檔案掛載本地:sshfs ghy@伺服器ip:伺服器上資料夾路徑 本地目標路徑

比如,1號機上:sshfs ghy@1**.18.2**.*8:/home/ghy/test /home/ghy/test2

其中,本地的test2資料夾要自己建立

sshfs可選引數,如,uid、noempty、allow_other等

檢視uid引數可輸入id命令

刪除掛載點:fusermount -u 掛載點路徑

如:fusermount -u /home/ghy/test2

Ubuntu 常用命令和一些 tips

001.ubuntu 解壓.tar.xz檔案到另乙個資料夾 sudo tar xvjf tar.xz c usr src sudo 超級使用者 tar 選項.file xvjf 解壓tar.xz c 新增指定的 file 至歸檔 注意 c 是大寫,ubuntu 是 區別大小寫的。002.ubuntu...

ubuntu的一些常用命令

1.解壓乙個zip文件 unzip archive name.zip 2.打包乙個tar目錄 tar cvf archive name.tar directory to compress 如何解包tar tar xvf archive name.tar.gz 3.ubuntu下移動檔案 1 將 us...

一些常用的命令

獲得所有裝置的功能,如頻寬資訊 2.4ghz,和5ghz 和802.11n的資訊 iw list 掃瞄 iw dev wlan0 scan 獲得鏈路狀態 iw dev wlan0 link 搜尋當前無線網路 iwlist wlan0 scanning 顯示頻道資訊 iwlist wlan0 freq...