Linux學習04

Tdyang111發表於2020-11-12
網路相關

wget - 網路下載器

  • wget https://www.sohu.com/
  • wget https://www.sohu.com/ -O sohu.html
  • wget https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png

scp - 安全的檔案拷貝(跨網路拷貝檔案)

sftp - 安全的檔案傳輸

ping - 網路可達性檢查

  • ICMP - Internet Control Management Protocol
  • RTT - Round Trip Time
  • TTL - time to live
    Ping to Death ----> DDoS
    分散式拒絕服務攻擊:Distributed Deny of Service
    DDoS高防服務(防D)----> 20w

ifconfig / ip —> 本機網路資訊

netstat —> 檢視網路埠使用狀況
-n:以數值的方式查詢網路埠資訊
-t:TCP(只檢視TCP協議的連線)
-l:listen(監聽狀態)
-p:process(程式)

ssh —> 安全遠端連線
如果公司有多臺雲伺服器,可以從一臺伺服器連線到其他伺服器
一般情況下,多臺伺服器中只有一臺允許從公網直接訪問,其他
伺服器都要通過這臺伺服器使用ssh的方式進行連線,不允許從
公網直接訪問,相當於做了物理隔離,而這臺可以從公網通過
SSH直接訪問的伺服器,我們通常稱之為跳板機(跳板伺服器)。

  • ssh root@47.104.31.138
Git的使用

初始化(建立本地版本控制倉庫):git init

新增檔案到倉庫的暫存區:

  • git add
  • git add .

從暫存區移除檔案:git rm --cached

檢視版本控制的狀態:git status

配置使用者名稱和郵箱:

  • git config --global user.email “jackfrued@126.com”
  • git config --global user.name “jackfrued”

將暫存區的檔案同步到本地倉庫:git commit -m ‘專案初始版本’

檢視提交日誌:git log

用暫存區恢復工作區:git restore

  • 誤修改 / 誤刪除

版本回退:git reset --hard d656a6

  • git reflog

繫結遠端伺服器(公司的Git私服):

  • 檢視:git remote -v
  • 新增:git remote add origin git@gitee.com:jackfrued/welcome2git.git

將程式碼上推到伺服器:

  • git push -u origin master

從伺服器克隆程式碼到本地:

  • git clone git@gitee.com:jackfrued/welcome2git.git
  • git clone git@gitee.com:jackfrued/welcome2git.git code
  • git clone --depth=1 git@gitee.com:jackfrued/welcome2git.git code

獲取伺服器上的程式碼:

  • git pull —> git fetch + git merge
  • 預設:fast-forward

相關文章