主题配置
1 | // This file was initially generated by Windows Terminal 1.4.3243.0 |
cmd
连接服务器
客户端生成ssh公私钥
ssh-keygen
本地ssh公钥追加到服务器
将id_rsa.pub
的内容复制到tmp.pub
1 | cd ~ |
重启terminal
成功!
解决终端链接服务器长时间不操作卡死
在服务器中执行
1 | vim /etc/ssh/sshd_config |
进入所在用户的.ssh
目录,
root用户的目录在:/root/.ssh/
创建config
文件vim /root/.ssh/config
在文件中添加:ServerAliveINterval 60
(没写错,就是INterval
,我也不知道为什么,)
保存退出,重新从终端通过ssh
进入服务器后不会因为长时间操作断开。
加入这句之后,ssh
客户端会每隔一段时间自动与ssh
服务器通信一次,所以长时间操作不会断开。
terminal
添加右键
检查常量
1 | echo %USERPROFILE% |
获取图标
创建Terminal
文件夹
1 | mkdir "%USERPROFILE%\AppData\Local\Terminal" |
保存这个 图标
添加注册表文件
新建一个文件 new.reg
1 | Windows Registry Editor Version 5.00 |
@
后面的[]改成电脑的用户名- 如果第一步
USERPROFILE
没有东西打印出来,那么这里的USERPROFILE
也改成C:\Users\你的用户名
- 第5行时图标保存的地址
执行reg
文件,可以发现右键多了一个windows termianl here
当前目录
在配置文件中添加或修改
1 | // 打开时的目录 |
这样也有一个缺点,直接打开termianl
时目录为C:\Windows\System32
目前没有解决方法
PowerShell
主题
安装oh-my-posh
主题
在terminal输入
1 | Install-Module posh-git -Scope CurrentUser |
输入Y
同意安装
更新配置文件
在terminal
输入$PROFILE
得到当前电脑的powershell_profile
文件
1 | PS C:\Windows\System32> $PROFILE |
继续输入
1 | if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } |
在打开的文件夹中添加
1 | Import-Module posh-git |
Set-Theme Honukai
是主题设置,其他可选主题
1 | Agnoster、Avit、Darkblood、Fish、Honukai、Paradox、Sorin、tehrob |
更新配置
输入你用$PROFILE
得到的路径
1 | C:\Users\64371\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
有些主题的样式可能会有些小空格,这时因为字体不支持poweline
,推荐选择Hack NF
字体,支持编程连字和poweline
字形
我的样式
powershell 5
power shell 7
Centos-terminal
主题
查看系统当前shell
1 | echo $SHELL |
结果
1 | /bin/bash |
查看/bin
下是否有zsh
包
1 | cat /etc/shells |
安装zsh
1 | sudo yum install -y zsh |
在/bin下查看
1 | /bin/sh |
将zsh
设置成默认shell
1 | chsh -s /bin/zsh |
修改zsh
为默认shell需要将以前在~/.bashrc
中的设置,复制到~/.zshrc
中
安装oh-my-zsh
需要先装git
1 | sudo yum install git |
修改host
1 | vim /etc/hosts |
添加
1 | 199.232.28.133 raw.githubusercontent.com |
下载
1 | sudo wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh |
配置主题
选择一款主题,修改~/.zshrc
1 | vim ~/.zshrc |
将ZSH_THEME
更改为选择的主题 jonathan
更新配置
source ~/.zshrc
重启
reboot
我的样式
aliyun Centos7
tencent Centos7
管理员
在powershell
中执行
1 | PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex" |
安装过程会询问你是否打算使用sudo
作为gsudo
的别名,这里可以根据个人需要进行选择。
运行结尾显示Done
即表明安装完成
安装完成后,在setting.json
中添加list
1 | { |
在普通的powershell
中执行sudo
,也可以升级成管理员