---
# System prepended metadata

title: Some knowledge on Ubuntu

---

# Some knowledge on Ubuntu 

了解ssh-agent


Find my computer didn't have git version
sudo apt install git

If you can't connect ubuntu server to update package
> can't connect............................

## Learn how to change the package server.

1. change [default ubuntu server](http://tw.archive.ubuntu.com) to 
    [go to the Ubuntu website find the address](http://free.nchc.org.tw/ubuntu/)
    
    1-1.http://free.nchc.org.tw/ubuntu/ also can't connect,so
    change to http://ftp.ubuntu-tw.net/ubuntu/


## Learn sed instruction on Ubuntu

https://terryl.in/zh/linux-sed-command/#-i-
sed -i 's/[target word]/[will change to word]/g' [address]

>It is an instruction to replace the string or character


## Update apt package
``` ubuntu=
$ sudo apt update
$ sudo apt upgrade
```
>update the apt package list
>upgrade is upgrade your computer



----------------

## Ubuntu file system

### ubuntu instruction

#### cat
```ubuntu=
cat > [filename].md
```
>cat is create the new file.

#### mv
```ubuntu=
mv [old_name] [new_name] 
```
>mv is to change the new name.

#### rename
> rename $1 $2 $3
> $1: 要被取代的關鍵字
> $2: 新的關鍵字
> $3: 檔名符合這個規則的才取代

> 把 IMG001.jpg, IMG002.jpg… 換成 img001.jpg, img002.jpg… 
```ubuntu=
rename IMG img IMG*
```
##### 把所有 .htm 檔案改成 .html
rename .htm .html *.htm

##### 把檔案 foo1, ..., foo9, foo10, ..., foo278.
rename foo foo0 foo?


##### 改成 foo001, ..., foo009, foo010, ..., foo278.
rename foo foo0 foo??



---


