본문 바로가기
Tools

Windows Terminal

by wycho 2020. 8. 17.

https://www.microsoft.com/ko-kr/p/windows-terminal/9n0dx20hk701?rtc=1&activetab=pivot:overviewtab

https://www.youtube.com/watch?v=8gw0rXPMMPE

 

Windows 에서 탭으로 구분된 cmd작업을 위한 툴이다.

기존에는 MobaXterm을 사용하고 있는데, 실행하고 클릭하여 접속하고 탭을 빼서 전체화면으로 전환하는 과정이 귀찮았다. Windows termianl 툴을 이용하면 세팅을 통해 이런 귀찮은 과정을 생략할 수 있다. 

 

설정 Ctrl+,

  • json형식의 설정파일에서 profiles - list 부분에 원하는 접속을 추가해 준 다음, "defaultProfile" 에 입력해 준다.
  • GUID 는 https://www.guidgen.com/ 에서 생성하여 사용한다.
  • 아래 예제는 윈도우10 내부 시스템인 Ubuntu에서 로그인 서버인 192.168.0.10을 통과하여, 원하는 접속 위치인 192.168.0.6으로 접속하는 방법이다.
  • sshpass 를 사용하기 위해서는, [ Windows terminal ]에서 ubuntu에 접속하여
    $ ssh -oProxyCommand="ssh user@192.168.0.10" user@192.168.0.6
    를 한번은 실행해 주어야 한다.
{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{307e9698-5363-4021-a922-cc9cde4615ff}",

    "launchMode": "maximized",
    
    "initialPosition": "0,0",
    
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": true,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    "wordDelimiters": "│",
    "rowsToScroll": 10,
    "showTabsInTitlebar":false,
    
    "profiles":
    {
        "defaults":
	{
	    "colorScheme": "Tango Dark",
	    "useAcrylic": true,
	    "acrylicOpacity": 0.9,
	    "fontSize":10,
	    "antialiasingMode":"cleartype",
	    "scrollbarState":"visible",
	    "backgroundImageOpacity" : 1,

	},
        "list":
        [
            {
                "guid": "{307e9698-5363-4021-a922-cc9cde4615ff}",
                "hidden": false,
                "name": "Ubuntu to 192.168.0.6",
                "tabTitle": "Ubuntu to 192.168.0.6",
                "commandline": "wsl -d Ubuntu-20.04 sshpass -p123456 ssh -oProxyCommand=\"sshpass -p567890 ssh -W %h:%p user@192.168.0.10\" user@192.169.0.6",
            }
        ]
    },

    "schemes": [],

    "keybindings":
    [
        // { "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" },

        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

탐색기

\\wsl$\Ubuntu

Keytweak portable

KeyTweak_2.3.0_Portable.zip
0.06MB

keymap.reg
0.00MB

 

Print Screen to /Pictures

remapPrtSc.exe
0.93MB

 

X-mouse

 

PowerShell

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

if Ubuntu is WSL1 not WSL2
wsl -l -v
wsl --set-version Ubuntu 2
wsl -t Ubuntu

 

Ubuntu

$ sudo sed -i s/kr.archive.ubuntu.com/mirror.kakao.com/g /etc/apt/sources.list

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo apt install ./google-chrome-stable_current_amd64.deb

$ sudo apt remove --autoremove emacs emacs-common
$ sudo add-apt-repository ppa:kelleyk/emacs
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
$ sudo apt update

$ sudo apt install emacs28 python3-tk python3-pip r-base r-base-dev -y
$ sudo apt install wget make gcc libgnutls28-dev pkg-config libncurses-dev -y

$ wget https://github.com/WonyoungCho/configure/raw/master/.emacs
$ wget https://github.com/WonyoungCho/configure/raw/master/.tmux.conf

$ sudo ln -s /usr/bin/python3 /usr/bin/python

$ pip install -U pip numpy pandas seaborn scikit-learn streamlit plotly
$ pip install -U notebook umap-learn sqlalchemy pymysql fastparquet pyarrow

Emacs packages: smart-compile, auto-complete
Emacs key bings: https://systemcrafters.net/emacs-essentials/efficient-selection-key-bindings/

                           : https://m.blog.naver.com/k_builder/40139166457

$ emacs -nw ~/.bashrc
# some more ls aliases
alias edt='emacs -nw ~/.bashrc'
alias edm='em ~/.tmux.conf'
alias em='emacs -nw'
alias sem='sudo emacs -nw'
alias l='ls -vxCF --color=auto'
alias lsd='ls -vxCFd */'
alias ll='ls -lhvF --color=auto'
alias lt='ls -alhvFtr --color=auto'
alias df='df -h'
alias du='du -h'

alias td='tree -d'

alias less='less -S'
alias lest='less $(\ls -v1td *.* | head -1)'
alias vdl='vd $(\ls -v1td *.* | head -1)'

alias wt="watch \"ls -alth\""

function cv() { column -ts $'\t' $1 |less;}
function cvc() { column -ts $',' $1 |less;}
function l5() { h5dump $1 |less;}

function scpi() { scp -r ycho@ipadd:$1 . ;}
function scpo() { scp -r $1 ycho@ipadd:~/getdata ;}

# directory
alias cdp='cd ~/program'
alias cdr='cd ~/research'
alias cda='cd $(\ls -v1td */ | head -1)'
alias cdg='cd ~/github'

# For tmux
alias tl='tmux ls'
alias t0='tmux attach -t 0'
alias t1='tmux attach -t 1'
alias t2='tmux attach -t 2'
alias t3='tmux attach -t 3'
alias t4='tmux attach -t 4'
alias t5='tmux attach -t 5'
alias t6='tmux attach -t 6'
alias t7='tmux attach -t 7'
alias t8='tmux attach -t 8'
alias t9='tmux attach -t 9'

alias inet='google-chrome-stable'

export PATH=~/program/tools:$PATH

export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
export LIBGL_ALWAYS_INDIRECT=1

HISTSIZE=10000
HISTFILESIZE=1000000

For GUI,

제어판 - Windows Defender 방화벽

X-server

  • Clipboard - check
  • Native opengl - uncheck
  • Disable acess control - check
  • -ac
  • Save configuration

CMD - shell:startup - copy X-server config file

 

# 재부팅 in PowerShell

wsl --shutdown

 

 

WSL2 GUI

- https://medium.com/@japheth.yates/the-complete-wsl2-gui-setup-2582828f4577

- https://velog.io/@yaincoding/WSL2-X-server

- https://sourceforge.net/projects/vcxsrv/

 

Expand VHD disk size

- https://docs.microsoft.com/en-us/windows/wsl/vhd-size

- https://github.com/microsoft/WSL/issues/4699

 

Reference

- https://docs.microsoft.com/ko-kr/windows/terminal/

- https://docs.microsoft.com/ko-kr/windows/terminal/customize-settings/color-schemes

- https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md

- https://docs.microsoft.com/en-us/windows/wsl/install-win10

 

 

윈도우11

# Windows 10 style of fast context menu
reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /d "" /f

# Remote Desktop in Windows Pro
reg add HKLM\Software\Policies\Google\Chrome /v RemoteAccessHostRequireCurtain /d 1 /t REG_DWORD /f && reg add “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server” /v fDenyTSConnections /d 0 /t REG_DWORD /f && reg add “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp” /v SecurityLayer /d 1 /t REG_DWORD /f && reg add “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp” /v UserAuthentication /d 0 /t REG_DWORD /f && net stop chromoting && net start chromoting

 

Link Windows IP add to WSL IP add

wsl-connect-external.ps1
0.00MB

 

 

Ubuntu key mapping

/usr/share/X11/xkb/symbols/pc

 

Git

git init
git config --global user.name "이름"
git config --global user.email 이메일@mail.com
git remote add origin https://github.com/주소
git config --global credential.helper store

git pull
git pull origin 브랜치

 

SSH

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub user@ipadd_to_connect_without_password

 

OPENVPN

sudo openvpn --config file --daemon
sudo killall openvpn

 

SWAP

sudo swapoff -a
sudo fallocate -l 120G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

sudo vi /etc/fstab
/swapfile swap swap defaults 0 0

sudo swapoff -v /swapfile

 

Ubuntu error

error: externally-managed-environment

sudo rm /usr/lib/python3.12/EXTERNALLY-MANAGED

 

nfs mount

sudo apt update
sudo apt install nfs-common

서버마운트
sudo mkdir /연결할_폴더
sudo mount -t nfs server_ip:/DATA /연결할_폴더

마운트해제
sudo umount -l /해제할_폴더

sudo vi /etc/fstab
server_ip:/DATA    /연결할_폴더    nfs    tcp,nolock    0    0

 

Emacs 27.1

install_emacs271.sh
0.00MB

'Tools' 카테고리의 다른 글

Monitoring jobs  (0) 2020.09.23
checkVCF  (0) 2020.09.15
Slurm - Workload manager  (0) 2020.08.15
GATK  (0) 2020.08.07
LDpop  (0) 2020.07.12

댓글