knowledge_map/linux常用指令.md
2024-11-14 18:20:55 +08:00

119 lines
3.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 基础指令
#### 查找并杀死进程
```sh
ps -aux|grep fava #查找包含fava的进程
# 输出结果
yewuya 5036 0.0 0.0 14828 1096 pts/0 S+ 14:51 0:00 grep --color=auto fava
# 5036为进程号
sudo kill -9 5036 #删除5036进程
```
```sh
ssh-copy-id yewuya@192.168.191.187 # 复制本地公钥到指定服务器用户实现免密登录
```
### git常用
#### 基础常用指令
```sh
git config --global --unset http.proxy//取消http代理
git config --global --unset https.proxy//取消https代理
git add . // 添加所有修改文件
git commit -am “” //添加所有修改文件的commit
git push origin master //上传代码到服务器
git remote rm origin //删除所有远程服务器
git remote add origin url //添加新的远程服务器
git submodule update --init --recursive //更新下载全部子模组
```
#### 生成密钥
```shell
git config --global user.name "yewuya" #配置用户名
git config --global user.email "yewuya0206@gmail.com" #配置邮箱
ssh-keygen -t rsa -C "yewuya0206@gmail.com" #生成密钥
```
#### 设置代理
```sh
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
git config --global http.proxy 'http://192.168.110.159:7980'
git config --global https.proxy 'http://192.168.110.159:7980'
```
#### 修改已提交的commit
```sh
git rebase -i HEAD~1 #修改commit HEAD~1为commit的数量
#在打开的文件中将需要修改的commit前的pick改为edit并保存关闭文件
git commit --amend #修改commit内容
git rebase --continue #完成内容修改
git push --force origin #强制提交
```
#### android 开发配置(硬件调试)
```sh
sudo apt-get install android-sdk-platform-tools-common
sudo usermod -aG plugdev $LOGNAME
sudo vi /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb" ENV{DEVTYPE}=="usb_device", MODE="0666" #文件内容
```
#### 文件解压 压缩
```
tar -xjvf test.tbz #解压tbz
tar -cjvf test.tbz flie #将flie打包压缩成 .tbz文件
```
#### curl 请求
```
curl -H "Content-type: application/json" -X POST -d '{"zoom"0}'[http://192.168.5.14/api/v1/zoom](http://fsc-inner.99bill.com/acs/deposit/1002)
curl -d "zoom=1" "http://192.168.5.14/api/v1/zoom"
```
#### 串口
```
stty -F /dev/ttySWK0 speed 115200 设置串口波特率
cat /dey/ttyUSB0 查看串口输出
```
#### 设置串口登录
``` sh
sudo systemctl enable serial-getty@ttyS0.service
sudo systemctl start serial-getty@ttyS0.service
```
#### ubuntu 20 配置静态IP
```yaml
network:
version: 2
renderer: NetworkManager
ethernets:
eth0: # 网卡名称
dhcp4: no # 关闭dhcp
dhcp6: no
addresses: [192.168.110.12/24] # 静态ip
gateway4: 192.168.110.1 # 网关
nameservers:
addresses: [8.8.8.8, 114.114.114.114] #dns
```
## 串口操作
### 配置串口登录
```sh
sudo systemctl enable serial-getty@ttyS0.service
sudo systemctl start serial-getty@ttyS0.service
```