Тут показані розбіжності між вибраною ревізією та поточною версією сторінки.
| Порівняння попередніх версій Попередня ревізія Наступна ревізія | Попередня ревізія | ||
|
software:os:linux:shell:setup [2020/01/31 15:10] charon |
software:os:linux:shell:setup [2020/02/03 17:02] (поточний) charon [Створити ~/.ssh/config] |
||
|---|---|---|---|
| Рядок 1: | Рядок 1: | ||
| - | Встановити пакети (приклад для робочої станції): | + | ===== Встановити пакети (приклад для робочої станції) |
| - | ncurses-term tree wget curl bash-completion git htop whois bzip2 mlocate pv unrar unzip anacron | + | ncurses-term tree wget curl bash-completion git htop whois bzip2 mlocate pv unrar unzip anacron |
| - | Для Убунту та Дебіан також: | + | |
| + | ===== Для Убунту та Дебіан також | ||
| apt-file | apt-file | ||
| - | Встановити | + | |
| + | ===== Встановити vim, якщо немає, наприклад | ||
| command -v vim > /dev/null || sudo apt install vim-nox | command -v vim > /dev/null || sudo apt install vim-nox | ||
| - | Створити додаткові каталоги: | + | |
| + | ===== Створити додаткові каталоги | ||
| mkdir -v ~/ | mkdir -v ~/ | ||
| chmod 700 ~/ | chmod 700 ~/ | ||
| - | Створити // | ||
| - | | ||
| + | ===== Створити ~/ | ||
| + | < | ||
| + | ###################### | ||
| + | # Configure PATH ENV # | ||
| + | ###################### | ||
| + | # if running bash | ||
| + | if [ -n " | ||
| + | # include .bashrc if it exists | ||
| + | if [ -f " | ||
| + | . " | ||
| + | fi | ||
| + | fi | ||
| + | |||
| + | # prepend additional user directories | ||
| + | path_array=("/ | ||
| + | |||
| + | for item in " | ||
| + | do | ||
| + | if [ -d " | ||
| + | PATH=" | ||
| + | fi | ||
| + | done | ||
| + | unset path_array | ||
| + | export PATH | ||
| + | |||
| + | ########################## | ||
| + | # Configure shell prompt # | ||
| + | ########################## | ||
| + | # Colors | ||
| + | # 0 - Black | ||
| + | # 1 - Red | ||
| + | # 2 - Green | ||
| + | # 3 - Yellow | ||
| + | # 4 - Blue | ||
| + | # 5 - Magenta | ||
| + | # 6 - Cyan | ||
| + | # 7 - White | ||
| + | # you can make it lighter with BOLD attribute | ||
| + | # | ||
| + | CNORM=" | ||
| + | CLIGHTGREEN=" | ||
| + | CGREEN=" | ||
| + | CLIGHTCYAN=" | ||
| + | CCYAN=" | ||
| + | CGRAY=" | ||
| + | CWHITE=" | ||
| + | CLIGHTRED=" | ||
| + | # assign colors to data | ||
| + | DAYC=$CLIGHTGREEN | ||
| + | DATEC=$CGREEN | ||
| + | PATHC=$CLIGHTGREEN | ||
| + | HOSTC=$CLIGHTCYAN | ||
| + | EVENTC=$CCYAN | ||
| + | TIMEC=$CGREEN | ||
| + | GTC=$CWHITE | ||
| + | LASTEXITC=$CLIGHTGREEN | ||
| + | SUCOLOR=$CLIGHTRED | ||
| + | # Prepare prompt | ||
| + | PRUSER=" | ||
| + | if [ " | ||
| + | PRUSER=" | ||
| + | fi | ||
| + | PS1=" | ||
| + | ${HOSTC}\h$CNORM: | ||
| + | export PS1 | ||
| + | # PS2 – Continuation interactive prompt | ||
| + | export PS2=" | ||
| + | |||
| + | # The PS4 shell variable defines the prompt that gets displayed, when you execute a shell script in debug mode | ||
| + | export PS4=' | ||
| + | |||
| + | ######## | ||
| + | # MISC # | ||
| + | ######## | ||
| + | export HISTSIZE=1000 | ||
| + | export HISTTIMEFORMAT=" | ||
| + | </ | ||
| + | |||
| + | ===== Створити ~/ | ||
| + | < | ||
| + | unalias ls | ||
| + | alias ls="/ | ||
| + | alias dir=" | ||
| + | alias l=" | ||
| + | alias cw=" | ||
| + | alias x=" | ||
| + | alias cls=" | ||
| + | alias bc=" | ||
| + | alias tt=traceroute | ||
| + | |||
| + | # Open last modified file in vim (not checked!) | ||
| + | alias Vim=" | ||
| + | |||
| + | # Find top 5 big files | ||
| + | alias findbig=" | ||
| + | |||
| + | # To clear all the history and screen | ||
| + | alias hcl=' | ||
| + | |||
| + | # Make basic commands verbose | ||
| + | alias cp="cp -v" | ||
| + | alias rm="rm -v" | ||
| + | alias mv="mv -v" | ||
| + | |||
| + | # To navigate to the different directories | ||
| + | alias ..='cd ..' | ||
| + | alias ...=' | ||
| + | |||
| + | # Create and change to a new directory | ||
| + | mcd () | ||
| + | { | ||
| + | if [ " | ||
| + | echo "mcd directory-name"; | ||
| + | else | ||
| + | if [ ! -d $1 ]; then | ||
| + | mkdir $1; | ||
| + | cd $1; | ||
| + | else | ||
| + | echo "$1 directory exists"; | ||
| + | fi; | ||
| + | fi | ||
| + | } | ||
| + | # display currently mounted file systems nicely | ||
| + | showmounted() { (echo " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Створити ~/ | ||
| + | < | ||
| + | Host test proverka | ||
| + | HostName test.example.org | ||
| + | User ninja | ||
| + | IdentityFile ~/ | ||
| + | |||
| + | Host * | ||
| + | User charon | ||
| + | # Keep-alive | ||
| + | ServerAliveInterval 45 | ||
| + | ServerAliveCountMax 3 | ||
| + | UseRoaming no | ||
| + | KexAlgorithms curve25519-sha256@libssh.org, | ||
| + | # Ensure KnownHosts are unreadable if leaked - it is otherwise easier to know which hosts your keys have access to. | ||
| + | HashKnownHosts yes | ||
| + | # Host keys the client accepts - order here is honored by OpenSSH | ||
| + | HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com, | ||
| + | |||
| + | MACs hmac-sha2-512-etm@openssh.com, | ||
| + | Ciphers chacha20-poly1305@openssh.com, | ||
| + | </ | ||