Try   HackMD

Linux常用指令

😵我是誰?我在哪?

# print working directory印出當前位置 ~$ pwd

👀我有甚麼?🌳

# 顯示這層所有資料夾與檔案 ~$ ls # 樹狀顯示"所有"資料夾與檔案 ~$ tree

🌳tree非內建,安裝方法:

~$ sudo apt-get update && apt-get install tree

複製

# 要複製的資料夾[filename] # 將複製的資料夾移動到[DirName] ~$ cp -r [filename]/ /workspace/[DirName]

❌刪除

# 刪除名稱[FileName]的檔案 ~$ rm [FileName] # 刪除名稱[DirName]的資料夾 ~$ rm -r [DirName]

🕳移動當前位置

~$ mkdir [DirName] #在當前目錄建立<DirName>資料夾 ~$ cd [DirName] #進入<DirName>資料夾 ~$ cd .. #返回上一層 ~$ cd ~ #到使用者初始位置 /home/[User]/
相對位置與絕對位置
  • 目前位置 : ~/workspace $
  • 絕對位置最前面有\;反之則無
/workspace/ShareDataset/AILABDATA # AILABDATA的絕對位置 ShareDataset/AILABDATA # AILABDATA的相對位置

🤑算東西🔢

# 算行數 ~$ [Command]|wc -l # 算字數 ~$ [Command]|wc -w # 算位元組數 ~$ [Command]|wc -c #[Command]:指令

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
GPU

📊資源占用情形

# 顯示顯卡(每秒更新) ~$ watch -n 1 -d nvidia-smi # 圖表 ~$ nvtop
  1. watch
    -n : 更新速度
    -d : 標示輸出差異處

https://blog.gtwang.org/linux/linux-watch-run-command-repeatedly/

  1. nvtop 安裝

https://github.com/Syllo/nvtop

👉指定GPU🔢

  • 基本上每個人在使用時,以一人一張GPU為準,請在程式的開頭加入以下程式碼:
# 加入此段程式在第一行 import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" #0 ->第一張V100 #1 ->第二張V100 #2 ->第三張V100 #3 ->第四張V100
tags:DgxGuide guide Linux