0%

常用Linux命令

查看指定端口进程

sudo lsof -i:port

关闭指定端口进程

sudo kill -9 `sudo lsof -t -i:port`

查看本机IP

curl -4 icanhazip.com

解压缩

1
2
tar -zcvf xxx
tar xvzf file.tar.gz

Git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Local->Local Git Repo
cd project_folder
git init
git add . (git add aFile)
git commit -m "Initial commit"

# Local Git -> Remote Git
git remote add origin git@github.com:xxx/xxx.git
(git remote rm origin)
git push -u origin master

# Remote Git->Local Git
git pull origin master

git branch new_branch
git checkout -b new_branch

git checkout branch_1
git merge branch_2

git branch -a

Vim

Copy and Paste

1
2
copy the whole file :%w !pbcopy
past from the clipboard :r !pbpaste

Vim Tutorial