# linux 常用指令 ###### tags: `Linux` `scp` ## 基本指令 ``` ls -lh //看檔案大小 ``` ## scp 本地端需安裝 openssh-client 套件。 遠端需安裝 openssh-server 套件。 ``` $ scp FileName jonny@remote:/home/jonny/ FileName: 預複製的檔案名稱。 jonny: 遠端使用者。 remote: 遠端伺服器的位址,可以是 IP 也可以是網域名稱(Domain name)。 /home/jonny/: 遠端伺服器內的檔案位置。 $ scp jonny@remote-server.net:/home/jonny/.bashrc . jonny: 遠端使用者。 remote: 遠端伺服器的位址,可以是 IP 也可以是網域名稱(Domain name)。 /home/jonny/.bashrc: 遠端伺服器內的檔案位置。 .: 當前目錄。 ``` ## 管線命令 ``` cut -d'分隔字元' -f fields grep [-acinv] [--color=auto] '搜尋字串' filename ``` ## 備份資料 1.mount usb到ubuntu上 ``` fdisk -l //查看usb位置、名稱、type mkdir /mnt/usb //建立資料夾 mount -v -t auto /dev/[查到的位置] /mnt/usb //掛載 ``` 2.使用tar 壓縮 壓縮 / 全部 --exclude排除的地方 ``` tar -cvpzf [壓縮檔案放的路徑]/[檔案名].tgz / --exclude=/ubuntu20160401.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/media --exclude=/dev ``` 3.卸載 ``` umount [掛載的位置] //如果device is busy. 找出開啟他的pid kill掉 lsof | grep [名稱] //找出開啟檔案的程式 kill -9 $pid ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up