主题配置
// This file was initially generated by Windows Terminal 1.4.3243.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
"tabWidthMode": "equal",
"theme": "light",
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
"fontFace": "CaskaydiaCove NF",
"fontSize": 16,
"cursorShape": "filledBox",
},
"list":
[
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell 7",
"source": "Windows.Terminal.PowershellCore",
"tabTitle": "PowerShell 7",
// morec
// 背景图片
"acrylicOpacity": 0.5,
"backgroundImage": "E:/picture/2020-12-18/wallhaven-o3d3w7.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImagerStretchMode": "fill",
"useAcrylic": true,
"padding": "0, 0, 0, 0",
// 键入时窗口滚动到输入行
"snapOnInput": true,
// 打开时的目录
"startingDirectory": ".",
// tab标题
"tabTitle": "powershell",
// 使用acrylic
"useAcrylic": false,
//主题
"colorScheme": "Solarized Dark Higher Contrast",
},
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "PowerShell",
"commandline": "powershell.exe",
"tabTitle": "PowerShell",
// morec
// 背景图片
"acrylicOpacity": 0.25,
"backgroundImage": "E:/picture/2020-12-07/wallhaven-y87dxx.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImagerStretchMode": "fill",
"padding": "0, 0, 0, 0",
// 键入时窗口滚动到输入行
"snapOnInput": true,
// 打开时的目录
"startingDirectory": ".",
// tab标题
"tabTitle": "powershell",
// 使用acrylic
"useAcrylic": false,
//主题
"colorScheme": "Cobalt Neon",
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false,
// more
"acrylicOpacity": 0.25,
"backgroundImage": "E:/picture/wallhaven-1kjqdw.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImagerStretchMode": "fill",
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"tabTitle": "cmd",
"useAcrylic": false,
//主题
"colorScheme": "Thanatos Dark",
},
{
// 通过terminal连接服务器
"guid": "{B5F0BC97-C32E-67A0-97E1-6112A50DF336}",
"name": "aliyun",
"commandline": "ssh root@123.56.252.111",
"acrylicOpacity": 0.4,
"backgroundImage": "E:/picture/2020-12-18/wallhaven-6oq5lq.jpg",
"backgroundImageOpacity": 0.4,
"backgroundImagerStretchMode": "fill",
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"tabTitle": "aliyun",
"useAcrylic": false,
"icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png", // 图标
//主题
"colorScheme": "Thanatos Dark",
},
{
"guid": "{db1d57fc-a9c1-4051-9677-f0232f905f60}",
"hidden": false,
"name": "Tencent Server",
"commandline": "ssh root@81.71.14.51",
"icon": "ms-appdata:///roaming/TencentServer.png",
// morec
// 背景图片
"acrylicOpacity": 0.5,
"backgroundImage": "E:/picture/2020-12-23/wallhaven-o3dvv9.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImagerStretchMode": "fill",
"useAcrylic": true,
"padding": "0, 0, 0, 0",
// 键入时窗口滚动到输入行
"snapOnInput": true,
// 打开时的目录
"startingDirectory": ".",
// tab标题
"tabTitle": "powershell",
// 使用acrylic
"useAcrylic": false,
//主题
"colorScheme": "Thanatos Dark",
"cursorColor" : "#FFFFFF",
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
{
"name": "Thanatos Dark",
"background" : "#1a2b3c",
"foreground" : "#e09887",
"selectionBackground": "#fef8ec",
"black": "#65737e",
"blue": "#0e9bd1",
"brightBlack": "#acacac",
"brightBlue": "#7899ba",
"brightCyan": "#0099ad",
"brightGreen": "#0de1b1",
"brightRed": "#d47186",
"brightWhite": "#fef8ec",
"brightYellow": "#d8cb32",
"brightPurple": "#ab43aa",
"purple": "#928ba6",
"cyan": "#008486",
"green": "#0099ad",
"red": "#ce4559",
"white": "#fef8ec",
"yellow": "#d8cb32"
},
{
"name": "Cobalt Neon",
"black": "#142631",
"red": "#ff2320",
"green": "#3ba5ff",
"yellow": "#e9e75c",
"blue": "#8ff586",
"purple": "#781aa0",
"cyan": "#8ff586",
"white": "#ba46b2",
"brightBlack": "#fff688",
"brightRed": "#d4312e",
"brightGreen": "#8ff586",
"brightYellow": "#e9f06d",
"brightBlue": "#3c7dd2",
"brightPurple": "#8230a7",
"brightCyan": "#6cbc67",
"brightWhite": "#8ff586",
"background": "#142838",
"foreground": "#8ff586"
},
{
"name": "Aurora",
"black": "#23262e",
"red": "#f0266f",
"green": "#8fd46d",
"yellow": "#ffe66d",
"blue": "#0321d7",
"purple": "#ee5d43",
"cyan": "#03d6b8",
"white": "#c74ded",
"brightBlack": "#292e38",
"brightRed": "#f92672",
"brightGreen": "#8fd46d",
"brightYellow": "#ffe66d",
"brightBlue": "#03d6b8",
"brightPurple": "#ee5d43",
"brightCyan": "#03d6b8",
"brightWhite": "#c74ded",
"background": "#23262e",
"foreground": "#ffca28"
},
{
"name": "FunForrest",
"black": "#000000",
"red": "#d6262b",
"green": "#919c00",
"yellow": "#be8a13",
"blue": "#4699a3",
"purple": "#8d4331",
"cyan": "#da8213",
"white": "#ddc265",
"brightBlack": "#7f6a55",
"brightRed": "#e55a1c",
"brightGreen": "#bfc65a",
"brightYellow": "#ffcb1b",
"brightBlue": "#7cc9cf",
"brightPurple": "#d26349",
"brightCyan": "#e6a96b",
"brightWhite": "#ffeaa3",
"background": "#251200",
"foreground": "#dec165"
},
{
"name": "Solarized Dark Higher Contrast",
"black": "#002831",
"red": "#d11c24",
"green": "#6cbe6c",
"yellow": "#a57706",
"blue": "#2176c7",
"purple": "#c61c6f",
"cyan": "#259286",
"white": "#eae3cb",
"brightBlack": "#006488",
"brightRed": "#f5163b",
"brightGreen": "#51ef84",
"brightYellow": "#b27e28",
"brightBlue": "#178ec8",
"brightPurple": "#e24d8e",
"brightCyan": "#00b39e",
"brightWhite": "#fcf4dc",
"background": "#142838",
"foreground": "#9cc2c3"
}
],
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
cmd
连接服务器
客户端生成ssh公私钥
ssh-keygen
本地ssh公钥追加到服务器
将id_rsa.pub
的内容复制到tmp.pub
cd ~
vi tmp.pub
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
cat tmp.pub >> .ssh/authorized_keys
rm tmp.pub
重启terminal
成功!
解决终端链接服务器长时间不操作卡死
在服务器中执行
vim /etc/ssh/sshd_config
ClientAliveInterval 60 // 每隔60S向客户端发送请求消息,并等待客户端响应
ClientAliveCountMax 10 // 客户端超过十次没响应,自动断开(即10分钟)
//重启sshd服务
//centos6
service ssh restart
//centos7
systemctl restart sshd
进入所在用户的.ssh
目录,
root用户的目录在:/root/.ssh/
创建config
文件vim /root/.ssh/config
在文件中添加:ServerAliveINterval 60
(没写错,就是INterval
,我也不知道为什么,)
保存退出,重新从终端通过ssh
进入服务器后不会因为长时间操作断开。
加入这句之后,ssh
客户端会每隔一段时间自动与ssh
服务器通信一次,所以长时间操作不会断开。
terminal
添加右键
检查常量
echo %USERPROFILE%
echo %LOCALAPPDATA%
获取图标
创建Terminal
文件夹
mkdir "%USERPROFILE%\AppData\Local\Terminal"
保存这个 图标
添加注册表文件
新建一个文件 new.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows Terminal here"
"Icon"="%USERPROFILE%\\AppData\\Local\\Terminal\\terminal.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\[你的电脑用户名!你的电脑用名!]\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
@
后面的[]改成电脑的用户名- 如果第一步
USERPROFILE
没有东西打印出来,那么这里的USERPROFILE
也改成C:\Users\你的用户名
- 第5行时图标保存的地址
执行reg
文件,可以发现右键多了一个windows termianl here
当前目录
在配置文件中添加或修改
// 打开时的目录
"startingDirectory": ".",
这样也有一个缺点,直接打开termianl
时目录为C:\Windows\System32
目前没有解决方法
PowerShell
主题
安装oh-my-posh
主题
在terminal输入
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
输入Y
同意安装
更新配置文件
在terminal
输入$PROFILE
得到当前电脑的powershell_profile
文件
PS C:\Windows\System32> $PROFILE
C:\Users\64371\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Windows\System32>
继续输入
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
在打开的文件夹中添加
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Honukai
Set-Theme Honukai
是主题设置,其他可选主题
Agnoster、Avit、Darkblood、Fish、Honukai、Paradox、Sorin、tehrob
更新配置
输入你用$PROFILE
得到的路径
C:\Users\64371\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
有些主题的样式可能会有些小空格,这时因为字体不支持poweline
,推荐选择Hack NF
字体,支持编程连字和poweline
字形
我的样式
powershell 5
power shell 7
Centos-terminal
主题
查看系统当前shell
echo $SHELL
结果
/bin/bash
查看/bin
下是否有zsh
包
cat /etc/shells
**********************************************
返回的结果是:
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
PS.默认没有安装zsh
安装zsh
sudo yum install -y zsh
在/bin下查看
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/zsh
将zsh
设置成默认shell
chsh -s /bin/zsh
修改zsh
为默认shell需要将以前在~/.bashrc
中的设置,复制到~/.zshrc
中
安装oh-my-zsh
需要先装git
sudo yum install git
修改host
vim /etc/hosts
添加
199.232.28.133 raw.githubusercontent.com
下载
sudo wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
配置主题
选择一款主题,修改~/.zshrc
vim ~/.zshrc
将ZSH_THEME
更改为选择的主题 jonathan
更新配置
source ~/.zshrc
重启
reboot
我的样式
aliyun Centos7
tencent Centos7
管理员
在powershell
中执行
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
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "PowerShell Administra",
"commandline": "sudo.exe powershell.exe",
"tabTitle": "PowerShell Administra",
// morec
// 背景图片
"acrylicOpacity": 0.25,
"backgroundImage": "E:/picture/2020-12-07/wallhaven-y87dxx.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImagerStretchMode": "fill",
"padding": "0, 0, 0, 0",
// 键入时窗口滚动到输入行
"snapOnInput": true,
// 打开时的目录
"startingDirectory": ".",
// tab标题
"tabTitle": "powershell",
// 使用acrylic
"useAcrylic": false,
//主题
"colorScheme": "Cobalt Neon",
},
在普通的powershell
中执行sudo
,也可以升级成管理员