# Ubuntu

## ITRI 命名規則

### 工研院桌電命名規則

單位-(0+工號)-設備代號&#x20;

example: 52-0A80006-01

## Ubuntu 好用指令

### 確認顯卡狀態(CUDA)

```bash
watch -n 0.5 nvidia-smi
```

### 確認系統狀態

```bash
htop
```

### 設定電腦名稱

```bash
sudo gedit /etc/hostname
sudo gedit /etc/hosts
#modify file contents about device name

#reboot for effective
sudo reboot

#check pc host name
hostname
```

### 畫出資料夾樹狀圖

```bash
sudo apt-get install tree
tree 
```

### 進入 Linux shell:

```
Ctrl + Alt + F2
```

### 退出 Linux Shell:

```bash
Ctrl + Alt + F7
```

### 確認 libjpeg 這個 libaray 版本

```bash
ldconfig -p | grep libjpeg
```

### 強制關閉某個程序(當滑鼠變成x,點選目標程式)

```bash
xkill 
```

### 查詢網路設定

```bash
ifconfig
```

### 僅顯示使用中的ip

```bash
ifconfig | perl -nle'/dr:(\S+)/ && print $1'
```

### 監聽特定 port 的資料

```bash
sudo tcpdump -i any port 443
```

### 移除某個套件 xxx

```bash
sudo apt-get remove xxx
sudo apt-get autoremove
sudo apt-get purge xxx
```

### 停止 Ubuntu 要求更新至 ver. 18

```bash
update-manager
#Notify me of a new Ubuntu version -> choose 'NEVER'
```

### 刪除資料夾

```bash
rm -rf
```

### 開機啟動指定命令

```bash
nano /etc/rc.local
#於 exit 0 前面加入所需的命令
```

### Install python3.6 and set python3.6 as default on Ubuntu 16.04

```bash
# install python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
# set python3.6 as main python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
```

### Install command "locate" on Ubuntu16.04

```bash
sudo apt-get install mlocate
sudo updatedb 
```

##
