Ubuntu - wlshiu/my_note GitHub Wiki
-
list install
$ dpkg -l | grep [name]
-
remove lib
$ sudo apt-get autoremove --purge [lib name]
-
zip
$ zip -re filename.zip filename
-
解壓 deb file
$ dpkg -x xxx.deb <target dir>
-
使用 update-alternatives 設定 python default
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
-
列出目前所有的 python version
$ update-alternatives --list python
-
切換 python default vesion
替換 python (提供 /usr/bin/python)
$ update-alternatives --config python There are 2 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3.7 2 auto mode 1 /usr/bin/python2.7 1 manual mode 2 /usr/bin/python3.7 2 manual mode Press <enter> to keep the current choice[*], or type selection number:
- 格式化 disk
# 一般名為:Disk /dev/sdb
$ sudo fdisk -l
$ sudo fdisk /dev/sdb
command (m for help):m
command (m for help):n # new a partition
Partition number(1-4):1 # select the target partition
...
command (m for help):w # write and exit
$ sudo mkfs.ext4 /dev/sdb1 # file system format
- 掛載
$ ls /dev/sd*
$ sudo mount /dev/sdb1 /data/
$ sudo chown <username>:<groupname> /data
$ sudo mount /dev/sdb1 $HOME/working/data/
-
ln [-hs] <source file/dir> <target source/dir>
-
-s
Synbolic Link原檔案或目錄被砍掉時, 這個 link 就會失效
# 在 $HOME建立一個連結, 連到 var/www/wpmu $ ln -s /var/www/wpmu $HOME/wpmu
-
-h
hard link
-
-
多檔案取代
$ grep -RiIl 'search' | xargs sed -i 's/search/replace/g'
$ sudo sed -i -- 's/us.archive/old-releases/g' /etc/apt/source.list
$ sudo sed -i -- 's/security/old-releases/g' /etc/apt/source.list
$ sudo apt update
$ sudo apt install curl
# 更換公鑰
$ curl -L https://debian.datastax.com/debian/repo_key | sudo apt-key add
# 更換 DNS
$ sudo vi /etc/resolv.conf
nameserver 8.8.8.8
-
generate ssh key
$ ssh-keygen Your identification has been saved in /home/username/.ssh/id_rsa_ubuntu. Your public key has been saved in /home/username/.ssh/id_rsa_ubuntu.pub. The key fingerprint is: SHA256:nNnQckFbuegUs4WD3y+7YqwCaDhfUlX2J17jxF7X3FU [email protected] The key's randomart image is: +---[RSA 2048]----+ | .o++ .. E| | . *o+. ..| | . = *+ o ..| | . . Ooo+ * +| | . o Soo..B o.| |o + o . ..o | | + o . . . . | | . . + o | | ..o .o. | +----[SHA256]-----+ $ ls ~/.ssh id_rsa id_rsa.pub
-
免密碼登入
-
local side
$ cp ~/.ssh id_rsa.pub ~/authorized_keys
-
remote side
put
authorized_keys
of local to remote$ cd ~/.ssh $ ls authorized_keys id_rsa id_rsa.pub
-
java.lang.IllegalArgumentException: Malformed \uxxxx encoding
昨天項目中遇到一個
java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
這樣的一個異常, debug了一下發現是讀取properties裡面的配置文件路徑的時候發生的.
網上找了一些解決方案, 只要把路徑中的 \
改為 /
就行了, 或者改為 \\
也行
- Linux Mint (Ubuntu)無法上網的解決方法
- 解決Ubuntu 14.04的enable wifi問題(ASUS F552CL)
- 在Ubuntu 14.04.2上之後,Wifi停止工作
- ubuntu 偵測的到無線網路卻無法連線!
PSCP 是一套使用命令提示列的軟體, 它提供 SCP client 的功能
λ pscp
PuTTY Secure Copy client
Release 0.70
Usage: pscp [options] [user@]host:source target
pscp [options] source [source...] [user@]host:target
pscp [options] -ls [user@]host:filespec
Options:
-V print version information and exit
-pgpfp print PGP key fingerprints and exit
-p preserve file attributes
-q quiet, don't show statistics
-r copy directories recursively
-v show verbose messages
-load sessname Load settings from saved session
-P port connect to specified port
-l user connect with specified username
-pw passw login with specified password
-1 -2 force use of particular SSH protocol version
-4 -6 force use of IPv4 or IPv6
-C enable compression
-i key private key file for user authentication
-noagent disable use of Pageant
-agent enable use of Pageant
-hostkey aa:bb:cc:...
manually specify a host key (may be repeated)
-batch disable all interactive prompts
-proxycmd command
use 'command' as local proxy
-unsafe allow server-side wildcards (DANGEROUS)
-sftp force use of SFTP protocol
-scp force use of SCP protocol
-sshlog file
-sshrawlog file
log protocol details to a file
-
download
# pscp [選項] 使用者名稱@host ip或名稱:要下載檔案的位置 本機存儲的位置 $ pscp [email protected]:/home/user/picture.jpg c:/document/picture.jpg
-
upload
# pscp 要上傳檔案的位置 [選項] 使用者名稱@host ip或名稱:遠端存儲的位置 $ pscp C:/document/picture.jpg [email protected]:/home/user/picture.jpg