常用命令
2023-03-20 14:56:42 时间
记录一些常用的系统或者软件命令
kill port
linux
# 查看端口占用
$ lsof -i :8080
# 结束进程
$ sudo kill -9 [pid]
windows
# 查看端口占用
$ netstat -aon | findstr 8080
# 查看 pid 进程
$ tasklist | findstr 19516
# 结束进程
$ taskkill /pid 19516 /F
# 或者使用进程名字
$ taskkill -F -IM node.exe
定时关机
linux
shutdown
有如下选项:
- k =>不执行任何关机操作,只发出警告信息给所有用户
- r => 重新启动计算机
- h => 关机并彻底断电
- f =>快速关机且重启动时跳过fsck
- n =>快速关机不经过init程序
- c => 取消之前的定时关机
立即关机:shutdown -h now
立即重启:shutdown -r now
注意:now 不能省略
$ shutdown -h +10 # 10分钟后自动关机
$ shutdown -h 10:00 # 10点整关机
windows
shutdown
-a =>取消关机
-s 关机
-f =>强行关闭应用程序
-l =>注销当前用户
-r =>关机并重启
-s -t 时间 =>设置关机倒计时
-h 休眠
$ shutdown -s -t 3600 # 一个小时候自动关机
刷新 dns hosts
windows
$ ipconfig /flushdns
Git
config
# 显示当前的 Git 配置
$ git config --list
# 编辑Git配置文件
$ git config -e [--global]
# 设置提交代码时的用户信息
$ git config [--global] user.name "[name]"
$ git config [--global] user.email "[email address]"
add
$ git add -A (stage all files: new, modified, deleted)
$ git add . (stage files: new, modified, deleted[version 2])
$ git add -u (stage files: modified, deleted)
$ git add --ignore-removal . (stage files: new, modified)
commit
$ git commit -m [message]
$ git commit [file1][file2]... -m [message] # file 要包含路径
# amend 使用一次新的 commit,替代上一次提交
# 如果代码没有任何新变化,则用来改写上一次 commit 的提交信息
$ git commit --amend -m [message]
# 重做上一次commit,并包括指定文件的新变化
$ git commit --amend [file1][file2]... -m[message]
pull
# 取回远程仓库的变化,并与本地分支合并
$ git pull [remote] [branch]
push
# 上传本地指定分支到远程仓库
$ git push [remote] [branch]
# 强行推送当前分支到远程仓库,即使有冲突
$ git push [remote] --force
# 推送所有分支到远程仓库
$ git push [remote] --all
branch
# 列出所有本地分支
$ git branch
# 列出所有远程分支
$ git branch -r
# 列出所有本地分支和远程分支
$ git branch -a
# 新建一个分支,但依然停留在当前分支
$ git branch [branch-name]
# 新建一个分支,并切换到该分支
$ git checkout -b [branch]
# 切换到指定分支,并更新工作区
$ git checkout [branch-name]
# 新建一个分支,与指定的远程分支建立追踪关系
$ git branch --track [branch] [remote-branch]
# 删除分支
$ git branch -d [branch-name]
# 删除远程分支
$ git push origin --delete [branch-name]
$ git branch -dr [remote/branch]
cherry-pick
# 选择一个commit,合并进当前分支
$ git cherry-pick [commit id]
remote
# 显示所有远程仓库
$ git remote -v
# 增加一个新的远程仓库
$ git remote add [shortname] [url]
相关文章
- 金融服务领域的大数据:即时分析
- 影响大数据、机器学习和人工智能未来发展的8个因素
- 从0开始构建一个属于你自己的PHP框架
- 如何将Hadoop集成到工作流程中?这6个优秀实践必看
- SEO公司使用大数据优化其模型的5种方法
- 关于Web Workers你需要了解的七件事
- 深入理解HTTPS原理、过程与实践
- 增强分析:数据和分析的未来
- PHP协程实现过程详解
- AI专家:大数据知识图谱——实战经验总结
- 关于PHP的错误机制总结
- 利用数据分析量化协同过滤算法的两大常见难题
- 怎么做大数据工作流调度系统?大厂架构师一语点破!
- 2019大数据处理必备的十大工具,从Linux到架构师必修
- OpenCV中的KMeans算法介绍与应用
- 教大家如果搭建一套phpstorm+wamp+xdebug调试PHP的环境
- CentOS下三种PHP拓展安装方法
- Go语言HTTP Server源码分析
- Go语言HTTP Server源码分析
- 2017年4月编程语言排行榜:Hack首次进入前五十