6626070
2997924

PL00, Linux

Back to the previous pagepage management
List of posts to read before reading this article


Contents


HW : Flashing OS image

balena etcher





SW : Basic

Ubuntu version

Ubuntu ,Official Archive Mirrors for Ubuntu
/etc/issue

$ cat /etc/issue





Upgrade ubuntu-version

URL

$ sudo apt update 
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo apt install update-manager-core
$ sudo do-release-upgrade

Manage file, folder

URL
Based on folder

Folder File Description
/etc /etc/issue  
  /etc/group user auth
  /etc/passwd user auth
  /etc/shadow user auth
  /etc/profile all user config
  /etc/profile.d all user config script file
  /etc/bash.bashrc all user config
  /etc/apt/sources.list apt packages source
  /etc/network/interfaces network
/var /var/lib/apt/lists/ apt packages
  /var/cache/apt/archives backup .dev files
~/ ~/.profile user config
  ~/.bashrc user config




Based on usage
|Usage|File| |:–|:–| |||





Configuration

$ date
$ date +%Y-%m-%d
Adjusting date
$ apt update
$ apt install ntp




.bashrc

alias gitlog='git log --all --graph --oneline'
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
export PATH=[PATH]:$PATH





Display manager

aptremove

$ apt update
$ apt install ubuntu-desktop
$ apt-get remove ubuntu-desktop
$ apt-get autoremove

tasksel
caution : when tasksel remove ubuntu-desktop, all dependencies is removed.

$ apt update
$ apt install tasksel
$ tasksel
$ reboot
$ tasksel --list-task
$ tasksel install [GUI-TASK-NAME]
$ service lightdm start
$ systemctl disable lightdm.service





Security

openssl

example

$ sudo apt install openssl
$ openssl req -newkey rsa:4096 \
              -x509 \
              -sha256 \
              -days 3650 \
              -nodes \
              -out example.crt \
              -keyout example.key





Command

/bin/
/sbin/
Parameter : -, –

$ [command] -[abbreviated_name]      : abbreviated type
$ [command] --[full_name]            : full type 




Command help

$ [command] --help            : command manual(simple)
$ man [command]               : command manual(detail) | find : /[pattern] | b(back), n(next), p(previous)
$ [command] --version         : verifing command version




Tip

$ history
$ ![command_number]      # execute corresponding command
$ !!                     # execute previous command
$ cd ~                   # move user directory
$ cd -                   # previous directory
$ [command];[command]    # run all at once
$ [command]&&[command]   # run sequencially if previous command work well


# ctrl + a  : ahead on command line
# ctrl + e  : end on command line

# alt + f : forward
# alt + b : backward


# ctrl + l : clear upper side all
# ctrl + k : clear right side all
# ctrl + u : clear left side all
# ctrl + y : recover

# alt + backspace : clear left word
# alt + d         : clear right word





Basic commands

Files list

$ pwd                   : parent folders(present location)
$ ls                    : subfolders list
$ ls -l                 : subfolders and files list (detail)
$ ls -a                 : subfolders and files list (hidden)
$ ls -al                : subfolders and files list (detail + hidden)    '$ ls -la is possible'
$ ls -alS               : subfolders and files list (detail + hidden + sorted by file size)
$ cd [folder_name]/     : move path(use Tap key!)




Create and Deleting

$ mkdir [folder_name]                                       : make folder
$ mkdir -p [folder_name1]/[folder_name2]/[folder_name3]     : make folder being having subfolders
$ touch [file_name]                                         : make file
$ rm [file_name]                                            : delete file
$ rm -r -f [folder_name]                                    : r; ignore sub-directory, f; ignore sub-file




Move and rename

$ mv [file_name] [directory_name]/[file_name]      : moving file
$ mv [old_file_name] [new_file_name]               : rename file




Copy ans Paste

$ cp /file_location([absolute_path]) /copy_location([absolute_path])                  : file copy
$ cp -r /folder_location([absolute_path]) /copy_location([absolute_path])             : folder copy




Directory movement

$ pwd
$ cd /~/~/~/~/                                                                   : absolute path movement
$ cd ./~/~/~/~/                                                                  : relative path movement
$ cd ../../                                                                      : back





Booting

  1. BIOS(Basic Input/Output System)
  2. MBR(Master Boot Recode)
  3. LILO or GRUB
  4. Kernel
  5. init : process number 1(PID=1)
    -/linuxrc : load modules / initialize devices / exits
    -/sbin/init
    -/etc/inittab : run boot scripts
    -/etc/init.d/rcS
    -/etc/rcS.d/S* scripts
    -/etc/rc.boot/*
  6. Run levels URL, /etc/rc[0-6] : init [0-6]




Booting message

/var/log/dmesg

$ dmesg

URL


Login

  1. /etc/environment ($ source /etc/environment;$ source ~/.profile; or re-login)
  2. /etc/profile, /etc/bash.bashrc
  3. /etc/profile.d/*.sh, ~/.bashrc
  4. ~/.profile



login shell

/bin/login

first user log in run level #3

  • /etc/profile
    • /etc/bash.bashrc
    • /etc/profile.d # script file
  • ~/.profile
    • ~/.bashrc



unlogin shell

/bin/bash or /bin/su or terminal

virtual terminal run

  • /etc/bash.bashrc
  • ~/.bashrc



logout script

logout

  • ~/.bash_logout





Exit

ctrl + d
$ poweroff
$ halt -p
$ showdown           # announce and shutdown in a while
$ showdown -c        # cancel shutdown
$ showdown -h now    # shutdown
$ init 0





Reboot

$ showdown -r
$ reboot
$ init 6





setup

  1. booting usb
  2. etcher, rufus
  3. flash




Package manager

useful package list
URL

  • elinks : web
  • tree : directory structure | URL




wget

/home/user/downloads/

$ wget [download_url]





dpkg

ubuntu package
/usr/local/
for .deb file

$ dpkg -i [package_name]      # install package
$ dpkg -l                     # list of installed packages
$ dpkg --get-selections       # list of installed packages
$ dpkg -l [package_name]      # check package was installed
$ dpkg -L [package_name]      # where package was installed
$ dpkg -r [package_name]      # delete package
$ dpkg -P [package_name]      # delete package with config





apt(apt-get)

/etc/apt/sources.list

repository description
main free, official
universe free, private
restricted no-free, official
multiverse no-free, private
$ apt update                                            # update package list lastest on sources.list
$ apt dist-update                                       # update package list lastest with config
$ apt upgrade [package_name]                            # upgrade package

$ apt-cache pkgnames                                    # list of package being able to install
$ apt-cache pkgnames | grep [package_name]              # search package(1)
$ apt-cache search [package_name]                       # search package(2)
$ apt-cache show [package_name]                         # show package with details
$ apt-cache policy [package_name]                       # installable version of package 
$ apt clean                                             # on /var/cache/apt/archives

$ add-apt-repository [repository_name]                  # add repository on sources.list
$ add-apt-repository --remove [repository_name]         # remove repository on sources.list
$ add-apt-repository ppa:[user/ppa-name]                # add private package archive on sources.list
$ add-apt-repository --remove ppa:[user/ppa-name]       # remove private package archive on sources.list

$ apt install [package_name]                            # install package of latest version on sources.list
$ apt install [package_name]==[version]                 # install package of specific version on sources.list
$ apt install --only-upgrade [package_name]             # upgrade already version on installed package
$ apt --installed list                                  # list of installed package

$ apt remove [package_name]                             # delete package
$ apt purge [package_name]                              # delete package with config





update-alternatives

environmental variables

$ echo $PATH
$ sudo echo $PATH
$ whereis [command]
$ which [command]
$ sudo which [command]




CREATE

$ ln -s [origin_file] [linked_file]           # put link file on place to be set environmental variables($ echo $PATH)

DELETE

$ rm -f [linked_file]

Change owner or group of a symbolic link | URL

$ chown -h [user_owner]:[group_owner] [symbol]




/etc/alternatives/

$ update-alternatives --install [linked_file_1] [link_group] [origin_file_1] 1    # create link group
$ update-alternatives --install [linked_file_2] [link_group] [origin_file_2] 2    # create link group
$ update-alternatives --install [linked_file_3] [link_group] [origin_file_3] 3    # create link group
$ ...
$ update-alternatives --config [link_group]      # set priority on link group
$ update-alternatives --all                      # show all link group                       





Server

Network

Setup

/etc/network/interfaces

$ cd /etc/network/
$ vim interfaces
OUTPUT

image

address [ip]
netmask [ip]
network [ip]
broadcast [ip]
gateway [ip]

dns-nameservers [ip]


$ systemctl restart networking
$ netstat -ntlep
netstat

netstat URL

$ netstat -a        # all
$ netstat -n        # numerical ip
$ netstat -t        # tcp protocol
$ netstat -l        # listening
$ netstat -e        # extended information
$ netstat -p        # with PID




Check ip

$ ip addr

image

Another ways

Private ip

$ ifconfig




Public ip

public ip : method 1

$ curl ipinfo.io

public ip : method 2
https://ipinfo.io/

public ip : method 3
Go to google and search ‘myip’


default gateway ip-address
$ ip route





web server : port 80

/etc/apache2/sites-enabled/000-default.conf

$ apt-get update
$ apt-get install apache2
$ service apache2 start
checking server
$ ps aux | grep apache2


$ htop

filter, apache2

$ apt-get install elinks
$ elinks [IP_address]





ssh server : port 22

/etc/ssh/sshd_config

$ apt-get update
$ apt-get install openssh-server
$ apt-get install openssh-client
$ service ssh start
checking server
$ ps aux | grep ssh

$ vim /etc/ssh/sshd_config
Port [number]
$ service sshd restart
access server
$ ssh -p [port_num] [id@IP_address]

access log : /var/log/auth.log
refer to this blog





generate RSA key

~/.ssh/

$ mkdir ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa -b 4096

id_rsa, id_rsa.pub

$ ssh-copy-id [id]@[ip]

authorized_keys



FTP server

File Transfer Protocol

Installation

$ apt update
$ apt upgrade
$ apt install vsftpd
$ service vsftpd status




Usage on windows

Basic command

ftp [ip_address]            # enter to shell on ip
ftp> help                   # list of ftp command
ftp> help [command]         # description of command
ftp> !                      # escape to the origin shell
ftp> ![command_on_windows]  # work on origin shell
ftp> quit                   # terminate ftp session




Useful command

ftp> ls
ftp> pwd
ftp> mkdir [directory_name]
ftp> rmdir [directory_name]
ftp> cd [path]
# download
ftp> get [file_name]
ftp> mget [*.*]

# upload
ftp> put [file_name]
ftp> mput [*.*]

when it happend to permission deined, edit #write_enable=YES to write_enable=YES in /etc/vsftpd.conffile. And then command sudo service vsftpd restart


WinSCP : SFTP

Download image





jupyter server

jupyter notebook : single mode

$ pip3 install notebook
$ python3
from notebook.auth import passwd
passwd()
$ jupyter notebook --generate-config
$ sudo vim /home/ailever/.jupyter/jupyter_notebook_config.py
c = get_config()
c.NotebookApp.password = u'hash'
c.NotebookApp.ip = 'ip_address'
c.NotebookApp.notebook_dir = '/home/'
c.NotebookApp.certfile = u'/home/ailever/ssl/cert.pem'
c.NotebookApp.keyfile = u'/home/ailever/ssl/cert.key'
RSA
$ cd /home/ailever
$ mkdir ssl
$ cd ssl
$ sudo openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -keyout "cert.key" -out "cert.pem" -batch

$ which jupyter-notebook
$ sudo vim /etc/systemd/system/jupyter.service
[Unit]
Description=Jupyter Notebook Server

[Service]
Type=simple
User=ailever
ExecStart=/usr/bin/sudo /usr/local/bin/jupyter-notebook --allow-root --config=/home/ailever/.jupyter/jupyter_notebook_config.py

[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl enable jupyter
$ sudo systemctl start jupyter
$ sudo systemctl status jupyter
$ sudo systemctl restart jupyter
$ jupyter-notebook --allow-root
ctrl + z
$ bg
$ disown -h 
$ sudo netstat -nap | grep 8888
$ sudo kill -9 [task_number]

URL


jupyterhub : multiuser mode

$ sudo apt update
$ sudo apt -y upgrade
$ sudo apt update
$ sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt -y install nodejs
$ sudo apt -y  install gcc g++ make
$ nodejs -v




latex syntax

image

#### equation(1)

\begin{align}
\dot{x} &= \sigma(y-x)\\
\dot{y} &= \rho x - y - xz\\
\dot{z} &= -\beta z + xz
\end{align}
#### equation(2)

\begin{equation*}
\left( \sum_{k=1}^{n} a_k b_k\right)^2 \leq \left( \sum_{k-1}^{n} a_k^2 \right) \left( \sum_{k-1}^{n} b_k^2 \right)
\end{equation*}
#### equation(3)

\begin{equation*}
\mathbf{V}_1 \times \mathbf{V}_2 = 
\begin{vmatrix}
\mathbf{i}                    & \mathbf{j}                    & \mathbf{k} \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0          \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0
\end{vmatrix}
\end{equation*}
#### equation(4)

\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac{l}{c}\,
\frac{\partial \vec{\mathbf{E}}}{\partial t} & = 
\frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & =
4\pi \rho \\
\nabla \times \vec{\mathbf{E}} + \frac{1}{c}\frac{\partial{\vec{\mathbf{B}}}}{\partial{t}} & =
\vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}





Scientific frameworks, packages, libaraies

Python

Installation : python

$ apt update
$ apt upgrade
$ apt install python3
$ apt install python2
$ python3 -V            # check version
$ python2 -V            # check version
Change command
$ which python3
$ cd [path]
$ ll python*
$ mv python3 python

Set PATH
$ echo $PATH
$ which python3
$ vim ~/.bashrc
export PATH=[PATH]:$PATH




Installation : pip

$ apt install python3-pip -y
$ apt install python2-pip -y
$ python3 -m pip install --upgrade pip
$ python2 -m pip install --upgrade pip
$ pip3 - V              # check version
$ pip2 - V              # check version
$ pip3 uninstall -y [package]




Installation for whl file

$ python3 -m pip install [*.whl]
$ python2 -m pip install [*.whl]




Virtualenv

Set Virtualenv URL

$ pip3 install virtualenv

Set PATH on virtual enviroment

$ virtualenv venv
$ source venv/bin/activate
$ which python3               # check Path
$ deactivate

python version

$ python3 -m virtualenv venv 
$ virtualenv venv --python=python3
$ virtualenv venv --python=python3.5





CUDA

Installation : CUDAURL

$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
$ sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
$ sudo apt-get update
$ sudo apt-get -y install cuda




Remove

$ apt clean; 
$ apt update; 
$ apt purge cuda; 
$ apt purge nvidia-*;
$ apt autoremove;




cudnn

URL ,runtime libraries for deep learning

$ sudo dpkg -i \ http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
$ sudo apt-get update && sudo apt-get install libcudnn7-dev
$ sudo apt-get install libcudnn7=7.6.5.32-1+cuda10.2
$ sudo apt-get install libcudnn7-dev=7.6.5.32-1+cuda10.2





Jupyter

Set python default versionURL

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
$ sudo update-alternatives --config python




Memorry Error during pip install

$ pip --no-cache-dir install [package_name]





Anaconda

anaconda3/envs/workspace/lib/python3.6/site-packages/
Anaconda Cloud

Installation

URLPost
Installation

$ wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
$ bash Anaconda3-2019.07-Linux-x86_64.sh

Initialization

$ source anaconda3/bin/activate
$ conda init




Set environment variable

$ vim /etc/profile
export PATH=[Path]:$PATH
$ source /etc/profile




Connect R

# installation R
$ conda install -c r r-core
$ conda install -c r r-essentials

IRkernel

$ apt-get install libzmq3-dev libcurl4-openssl-dev libssl-dev jupyter-core jupyter-client
# install package
> install.packages(c('repr', 'IRdisplay', 'IRkernel'), type = 'source')

# interlock R with jupyter
> IRkernel::installspec()




Usage

anaconda3/envs/

$ conda --version
$ conda update conda
$ conda create --name [env_name] python=[version]
$ conda create --name [env_name] [package] python=[version]
$ conda remove --name [env_name] --all
$ conda info --envs                 # same to below
$ conda env list                    # same to above
$ conda list                        # list of packages
$ conda activate [env_name]
$ conda deactivate
$ conda install [package]





Docker

nvidia containers

$ apt update
$ apt search docker | grep docker.io

# Display Meta-Information for docker.io Package
$ apt policy docker.io

# Remove Previous Installations of docker
$ apt remove docker

# Allow apt to Use a Repository Over HTTPS
$ apt install apt-transport-https ca-certificates curl software-properties.common

# Add Docker’s Official GPG Key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
$ apt-key fingerprint 0EBFCD88

# Add Your System’s Specific Docker Repository
$ add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

$ apt update
$ apt install -y docker-ce

$ sudo groupadd docker
$ sudo usermod -aG docker $USER




nvidia/cuda

nvidia/cuda:10.2-base

#### Test nvidia-smi with the latest official CUDA image
$ docker run --gpus all nvidia/cuda:10.2-base nvidia-smi




tensorflow/tensorflow

tensorflow/tensorflow:latest-gpu

$ docker run -it --gpus all -v [local_path]:/local_host --name [container_name] tensorflow/tensorflow:latest-gpu bash




tensorflow/tensorflow:latest-gpu-jupyter

$ docker run -it --gpus all -v [local_path]:/local_host --name [container_name] -p [jupyter_port]:8888 -p [tensorboard_port]:6006 rflow/tensorflow:latest-gpu-jupyter




nvir.io/nvidia/pytorch

nvir.io/nvidia/pytorch:20.03-py3

$ docker run --gpus all -it -v [local_path]:/local_host --name [container_name] nvcr.io/nvidia/pytorch:20.03-py3




jupyterhub/jupyterhub

jupyterhub/jupyterhub

$ docker run --gpus all -v [local_path]:/local_host --name [container_name] -p [port1]:8000 -p [port2]:6006 -d jupyterhub/jupyterhub jupyterhub
$ docker exec -it jupyterhub bash





Docker machine

docker machine installation

$ apt install virtualbox
$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
> curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
> sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
> chmod +x /usr/local/bin/docker-machine

/etc/bash_completion.d/docker-machine-prompt.bash

base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
  sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done
$ source /etc/bash_completion.d/docker-machine-prompt.bash

~/.bashrc

PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '
$ source ~/.bashrc
$ sudo docker-machine create --driver virtualbox default




basic command

$ docker-machine --help
$ docker-machine version
$ docker-machine --ls
$ docker-machine create [machine_name]
$ docker-machine env [machine_name]    # set environment of docker-machine

export DOCKER_CERT_PATH=”/home/user/.docker/machine/machines/[machine_name]”





Device Management

Device mount

/media/
/mnt/
/dev/

$ ls /dev/




Storage

$ df -h
$ lsblk


mount process

$ mkdir /media/usb
$ mount /dev/[device] /media/usb
SUPPLEMNET
$ man mount
$ mount -t [type]




umount process

$ umount /dev/[device] /media/usb




Large storage mount

URL





nmcli : Connect wifi

$ nmcli dev status
$ nmcli device wifi rescan
$ nmcli device wifi list
$ nmcli device wifi connect “[wifi-name]” password “[wifi-password]”





System Utils

Vim

vim 8.2

$ sudo add-apt-repository ppa:jonathonf/vim
$ sudo apt update
$ sudo apt install vim
Error

If you don’t have ‘add-apt-repository’,

$ apt install software-properties-common




vim0 vim BasicURLkeymap notation

:set paste             # insert mode, shift + insert

:new [file_name]
:sav #                 # #(숫자를 의미)에 해당하는 파일을 '다른 이름'으로 저장한다.  

:w                     # :(콜론)을 누른 다음에 w를 입력한 것입니다. :w # 처럼 숫자(#는 숫자입력을 표시)에 해당하는 파일 이름을 저장할 수 있다. 
:w file.txt            # file.txt 파일로 저장
:w ≫ file.txt         # file.tx파일에 덧붙여서 저장
:wq!                   # 강제 저장 후 종료
:q                     # vi 종료
:q!                    # vi 강제 종료

:e [file_name]         # file.txt file.txt파일을 불러옴
:e                     # 현재 파일을 불러옴
:e#                    # 바로 이전에 열었던 파일을 불러 옴

:vs ./
:sp ./

:up                    # 바뀐 내용만 저장합니다.
:x                     # :upq와 같은 내용입니다.
ZZ                     # 저장 후 종료

ctrl + w + =
ctrl + w + _
ctrl + w + |
ctrl + w + q

viw                    # select word
vi(                    # select argument
gd                     # word highlighting
shift+k                # explaination

my default vimrc
~/.vimrc

set hlsearch
set nu
set tapstop=4
set shiftwidth=4




vundle : plugin management|vim awesome

plugins
vundle vim

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

~/.vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'severin-lemaignan/vim-minimap'
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'lfv89/vim-interestingwords'
Plugin 'mattesgroeger/vim-bookmarks'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
 
set hlsearch
set nu
set tabstop=4
set shiftwidth=4

" Plugin setup "
""""""""""""""""

" vim-minimap

" nerdtree
map <Tab> :NERDTreeToggle<CR>

" tagbar
let g:Tlist_Ctags_Cmd='/usr/bin/ctags'
map <leader><Tab> :TagbarToggle<CR>
 
" vim-interestingwords
let g:interestingWordsGUIColors = ['#00FF7C', '#0400FF', '#00FFF0', '#FF0000', '#FFEC00', '#FFB3FF']
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
nnoremap <silent> <leader>k :call InterestingWords('n')<cr>
nnoremap <silent> <leader>K :call UncolorAllWords()<cr>
nnoremap <silent> n :call WordNavigation('forward')<cr>
nnoremap <silent> N :call WordNavigation('backward')<cr>
set termguicolors
 
"" vimspector
"let g:vimspector_enable_mappings = 'HUMAN'
"packadd! vimspector

" vim-bookmarks
highlight BookmarkSign ctermbg=NONE ctermfg=160
highlight BookmarkLine ctermbg=194 ctermfg=NONE
let g:bookmark_sign = '♥'
let g:bookmark_highlight_lines = 1
 
---
:source %
:PluginInstall
:PluginClean # if you want to delete vundle,

plugin list

vimspector
~/.vim/

$ mkdir -p $HOME/.vim/pack
$ cd pack
$ wget https://github.com/puremourning/vimspector/releases/download/1525/linux-5faf56de9d0a50410f697403ff513253af495f74.tar.gz
$ tar -zxvf linux-5faf56de9d0a50410f697403ff513253af495f74.tar.gz

~/.vimrc

let g:vimspector_enable_mappings = 'HUMAN'
packadd! vimspector

~/.vim/pack/vimspector/opt/vimspector

$ ./install_gadget.py --enable-python
$ ./install_gadget.py --enable-bash

.vimspector.jsonjson example

{
  "configurations": {
    "<name>: Launch": {
      "adapter": "debugpy",
      "configuration": {
        "name": "<name>: Launch",
        "type": "python",
        "request": "launch",
        "cwd": "./",
        "python": "/home/dongmyeong/anaconda3/envs/workspace/bin/python",
        "stopOnEntry": true,
        "console": "externalTerminal",
        "debugOptions": [],
        "program": "workspace.py"
      }
    }
  }
}




screen

Layout

$ screen -ls
$ screen -S [session_name]          # create session
$ screen -x [session_name]          # access session
$ ctrl + a, d                       # detach session
$ ctrl + d                          # exit session
$ screen -XS [session_name] quit    # exit session
ctrl + a, :layout new
ctrl + a, :layout show
ctrl + a, :layout select [num]
ctrl + a, :layout title [name]
ctrl + a, :layout save
ctrl + a, :layout remove [num]

ctrl + a, ?                  # help

ctrl + a, shift + \          # split window : vs
ctrl + a, shift + s          # split window : sp
ctrl + a, :resize max        # resize window(1)
ctrl + a, :resize -b =       # resize window(2)
ctrl + a, shift + x          # remove window(1)
ctrl + a, :remove            # remove window(2)
ctrl + a, tab                # move window
ctrl + a, shift + q          # initialize window

ctrl + a, c                  # create new bash-process
ctrl + a, p                  # change previous process
ctrl + a, n                  # change next process
ctrl + a, '                  # change user want to set process
ctrl + a, shift + '          # list process(1)
ctrl + a, w                  # list process(2)
ctrl + a, shift + a          # name process

ctrl + a, shift + x          # hide screen
ctrl + a, k                  # kill process
ctrl + a, s                  # lock window
ctrl + a, q                  # unlock window

ctrl + a, [                  # copy
ctrl + a, ]                  # paste




Tmux

.tmux.conf

set -g mouse on
$ tmux ls                                    # session list
$ tmux                                       # make session
$ tmux new -s [session_number_or_name]       # make session
$ tmux attach -t[session_number]             # enter session
$ tmux kill-session -t[session_number]       # kill session
ctrl + b, %             # vertical
ctrl + b, "             # horizental
ctrl + b, spacebar      # alignment
ctrl + b, arrow         # move window (1)
ctrl + b, q             # move window (2)
ctrl + b, w             # movw window (3)
ctrl + b, z             # zum
ctrl + b, d             # to origin 
ctrl + b, x             # exit window
ctrl + d                # terminate session
ctrl + b, $             # rename session
ctrl + b, ,             # rename window

ctrl + b, [             # enter copy mode
  ctrl + space            # copy start
  alt + up, down          # fast moving
  alt + w                 # copy end
  q                       # exit
ctrl + b, ]             # paste





Document Utils

pdf

URL Installation

$ apt install poppler-utils

Merge

$ pdfunite source1.pdf source2.pdf merge.pdf

List of posts followed by this article


Reference





OUTPUT