--- title: Day 5 工程入門 (Neo) tags: '課程筆記' --- # Day 5 工程入門 (Neo) [TOC] --- ## linux系統 [鳥哥!!!](http://linux.vbird.org/linux_basic_train/) 'jovyan@6802abed1095' = 'user + 機器名稱' 「~」 user資料夾 cd + () 要去哪個資料夾 cd . 到原本的層 cd ..到上一層 cd 直接回user位置(~) cd / 到根目錄 clear 把東西都清掉 ls -lh 查看檔案權限 sudo chmod 766 invoice.csv -> 更改owner對invoice.csv的權限為rwx rw- rw- sudo chown owner更改owner、group mkdir 新增資料夾 mv + (檔案) + (地點) 移動檔案 mv invoice.csv(old name) invoice_rename.csv(new name) 重新命名 head/tail -10 invoice 列出檔案前10筆資料 cat + filename j -> 看檔案內容 or 直接用 nano history 看下過哪些指令 su - 切換root(輸入exit離開) sudo -i 切換root(輸入exit離開) su (user) 切換使用者到user exit 離開root htop 監控機器使用狀態 curl 下載 (指令) --help cp 複製+filename+path ![](https://i.imgur.com/6Pvh3JL.png) (要先安裝 - sudo apt install htop) top 出去要用 control+C 寫入資料 1. 裝nano sudo apt update sudo apt install nano 2. 建檔案 nano + (name) 3. 開始寫 -> control+O(儲存) -> enter -> control+X(跳出) 4. 刪檔案 rm + (name) rm -r 刪資料夾 rm (name)* 刪除檔案夾中所有name開頭的資料 ==善用TAB TAB按一次-直接打字 TAB按兩次-跳出所有可以去的地方== --- ![](https://i.imgur.com/pEzto96.png) ``` -rw-r--r-- 1 jovyan users 227350 Jan 15 07:35 invoice.csv -rw-r--r-- 1 jovyan users 7178 Jan 15 07:40 invoice_practice.ipynb ``` 結構:權限+owner+group+檔案大小+最後修改時間 > ### rwx(read(4) write(2) execute(1)) > rw- (4+2=6) r-- (4) r-- (4) -> owner group other權限 owner可以讀取、寫入 , group、other只能讀取 「d」是目錄 「-」是檔案 「s」看補充 chmod 更改存取讀寫權限 ( sudo chmod 766 invoice.csv ) chown 更改owener、group * 補充:S的意思 'S' = The directory's setgid bit is set, but the execute bit isn't set. 's' = The directory's setgid bit is set, and the execute bit is set. SetGID = When another user creates a file or directory under such a setgid directory, the new file or directory will have its group set as the group of the directory's owner, instead of the group of the user who creates it. --- ## [Google Compute Engine 如何連線至Linux執行個體](https://medium.com/@pk60905/google-compute-engine-如何連線至linux執行個體-b048fdfbaff3) [安裝](https://cloud.google.com/sdk/docs/downloads-interactive?hl=zh-tw) [解決 gcloud command not found ](https://stackoverflow.com/questions/31037279/gcloud-command-not-found-while-installing-google-cloud-sdk) 排程:sudo nano /etc/crontab 在16:34 寫入"log_1": 34 16 * * * worker python3 /home/worker/hello-world.py > /home/worker/log_1 ( > 覆蓋 ) ( >> 往下寫 ) 更改時區 - sudo timedatectl set-timezone Asia/Taipei 重新啟動 - sudo service cron restart