๐๋์ ๋์ ์ ์ฉํ ํ๋ค
- ๋งฅ์์ ๋ถํ ์์ถ ํธ๋ ๋ฐฉ๋ฒ
- Mac ํฐ๋ฏธ๋ iterm2 ์ปค์คํ
- Ssh๋ก remote server ์ ์ ์ terminal ์๊น ์ ํ๊ธฐ
- Ssh ๋น๋ฐ๋ฒํธ๋ก ์ ์ ์ค์ ํ๊ธฐ
- Ssh๋ก remote server ์ ์ ์ alias ๊ธฐ๋ณธ์ผ๋ก ์ค์ ํ๊ธฐ
- Ssh๋ก remote server ์ ์ ์ bashrc ๊ธฐ๋ณธ์ผ๋ก ์คํํ๊ธฐ
- ํ์ ํด๋์์ ์๋ ํ์ผ ๊ฐ์ ์ถ๋ ฅ
- Ssh ์๋ฒ ํ์ผ ์๊ฒฉ ์ ์กํ๊ธฐ
- ํ์ด์ฌ ๋ฆฌ์คํธ ํ์ ํ๊ธฐ
- GPU์ ๋ฉ๋ชจ๋ฆฌ๋ ํ ๋น๋์ด ์๋๋ฐ nvidia-smi์๋ ์๋์ฌ ๋
zip -FF ๋ถํ ์์ถ๋์๋ณธํ์ผ๋ช .zip --out ํ๊ฐ๋ก์์ถ๋ ํ์ผ๋ช .zip
unzip -qt ํ๊ฐ๋ก์์ถ๋ ํ์ผ๋ช .zip
EX) ํ์ผ๋ช ์ด
data.zip
,data.z01
,data.z02
์ด๋ ๊ฒ ๋์ด์์ ๋
zip -FF data.zip --out data_concat.zip
์ผ๋ก ์์ถ ํ์ผ ํฉ์น๊ธฐunzip -qt data_concat.zip
์ผ๋ก ํฉ์น ํ์ผ ์์ถ ํ๊ธฐ
์ด์ ์ ํฐ๋ฏธ๋์ ์ปค์คํ ํ ์ ์ด ์์ด Oh My Zsh๊ฐ ์ด๋ฏธ ๊น๋ ค์๋ ์ํฉ์ด๋ผ๋ฉด ์๋ ์ฝ๋๋ก ํฐ๋ฏธ๋ ์ด๊ธฐํ๋ฅผ ์์ผ์ค๋ค.
rm -rf ~/.oh-my-zsh
rm ~/.zshrc
cp ~/.zshrc.pre-oh-my-szh ~/.zshrc
source ~/.zshrc
.zshrc์ ๋ค์ด๊ฐ์ ํ๊ฒฝ๋ณ์ ์ค์ ์๋ ์ฝ๋๋ค์ ์ ์ผ ๋ฐ์ ์ถ๊ฐํด์ฃผ์
vi ~/.zshrc // .zshrc ํธ์ง
// ์๋ ์ฝ๋ ์ถ๊ฐ
export PATH=$HOME/bin:/usr/local/bin:/anaconda3:/anaconda3/bin:$PATH
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/Sangjin/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/Sangjin/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/Sangjin/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/Sangjin/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
~/.bashrc
์ ์๋ ์ฝ๋๋ฅผ ์ถ๊ฐํด์ค๋ค.
# >>> enable color support of terminal directory >>>
export PS1="\[\e]0;\u@\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w #\[\033[00m\] "
# <<< enable color support of terminal directory <<<
# >>> enable color support of ls and also add handy aliases >>>
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# <<< enable color support of ls and also add handy aliases <<<
- ์ดํ
source ~/.bashrc
๋ฅผ ์คํํ์ฌ ์ ์ฉ์์ผ์ค๋ค.
- root ๊ถํ์ผ๋ก
passwd root
๋ฅผ ์ ๋ ฅํ์ฌEnter new UNIX passwd
์Retype new UNIX passwd
์ ๋์ผํ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ค. - root ๊ถํ์ผ๋ก
vim /etc/ssh/sshd_config
๋ฅผ ์ ๋ ฅํ์ฌ/etc/ssh/sshd_config
ํ์ผ์ ์ด์ด์PasswordAuthentication yes
๋ก ๋ณ๊ฒฝ์ ํด์ค๋ค. - ๋ง์ง๋ง์ผ๋ก root ๊ถํ์ผ๋ก
service ssh restart
๋ฅผ ํ์ฌ ssh ์ฌ๋ถํ ์ ์์ผ์ค๋ค. - ์ดํ
ssh root@<your ip> -p <your port>
๋ก ์ ์์ ํ๋ฉด ์ค์ ํ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ์ฌ ์ ์ํ ์ ์๋ค.
~/.bash_aliases
์ ```alias`๋ฅผ ์ ์ฉํ ์ฝ๋๋ฅผ ์์ฑํด์ค๋ค.
alias ll='ls -al'
~/.bashrc
์ ์๋ ์ฝ๋๋ฅผ ์ถ๊ฐํด์ค๋ค.
# >>> enable '.bash_aliases' >>>
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# <<< enable '.bash_aliases' <<<<
~/.bash_profile
ํ์ผ์ ์์ฑํ๊ณ ์๋ ์ฝ๋๋ฅผ ์ถ๊ฐํ๋ค.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
cd ~
fi
for x in `ls` ; do echo $x: `find $x -type f | wc -l`; done
์ถ๊ฐ๋ก ~/.bash_aliases
์ alias fn='for x in `ls` ; do echo $x: `find $x -type f | wc -l`; done'
๋ฅผ ์ถ๊ฐํด์ฃผ๋ฉด ํธํ๊ฒ fn
๋ช
๋ น์ด๋ก ์คํ์ํฌ ์ ์๋ค.
- Local์์ ssh๋ก ํ์ผ ์ ์ก
scp -r {local ์๋ฒ ์ฃผ์} {ssh ์๋ฒ ์ฃผ์}
ex) scp -r [email protected]:/opt/ml/code /Users/Desktop/
- Ssh์์ local๋ก ํ์ผ ์ ์ก
scp -r {ssh ์๋ฒ ์ฃผ์} {local ์๋ฒ ์ฃผ์}
ex) scp -r /Users/Download/a.txt [email protected]:/opt/ml/code
k = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
# ์๊ณ ๋ฐฉํฅ ํ์
li = [list(k[::-1]) for k in zip(*k)]
# zip๋ฅผ ์จ์ ๊ฐ ์ธ๋ฑ์ค์ ๋ชจ๋ element๋ฅผ ํ iterator์ ๋ฃ๊ณ asterisk๋ฅผ ์ด์ฉํ์ฌ ํ์ด์ ํ์ ์๊ณ ๋ฆฌ์ฆ์ ๊ตฌํ
# ex) k = [[1, 2, 3], -> ์ํ๋ ์ถ๋ ฅ form: [[7, 4, 1],
# [4, 5, 6], [8, 5, 2],
# [7, 8, 9]] [9, 6, 3]]
# zip(*k) = [[1, 4, 7],
# [2, 5, 8],
# [3, 6, 9]]
print(li)
# ๋ฐ ์๊ณ ๋ฐฉํฅ ํ์
li = [list(k) for k in reversed(tuple(zip(*k)))]
# ์๊ณ ๋ฐฉํฅ๊ณผ ๋์ผํ ๋ฐฉ์์ด์ง๋ง, reversed ํค์๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐฐ์ด์ ์ญ์ ํ์์ด ๊ฐ๋ฅํ๊ฒ ํจ
# ex) k = [[1, 2, 3], -> ์ํ๋ ์ถ๋ ฅ form: [[3, 6, 9],
# [4, 5, 6], [2, 5, 8],
# [7, 8, 9]] [1, 4, 7]]
# reversed(tuple(zip(*k))) = [[3, 6, 9],
# [2, 5, 8],
# [1, 4, 7]]
print(li)
for i in $(ps aux | grep python | awk '{print $2}' | sort -u); do kill -9 $i; done