コマンド

tips

  • screen
コマンド 説明
screen -S セッション名 セッション名を付けて端末エミュレーションを実行する。
screen -r リタッチする。
screen -d [pid.tty.host] デタッチする。
screen -xr マルチディスプレイモードでアタッチする
screen -ls セッションに対応する pid.tty.host 形式の文字列をリスト表示する。
  • .screenrc

    autodetach on
    bind w windowlist -b
    escape ^w^w
    
    utf8 on
    
    TranslateWheelToCursor=off
    
    defscrollback 10000
    termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;5l'
    
    setenv SCREENTITLE auto
    caption always "%-w%10L>%{=b bw}%n %t%{-}%+w%-0="
    
    hardstatus on
    hardstatus alwayslastline "%H(w)%=%Y/%m/%d %02c"
    
    startup_message off 
    termcapinfo xterm* ti@:te@
    
    vbell off 
    
    bind ^U encoding utf8
    bind ^E encoding euc 
    bind l windowlist
    
    bind r eval 'echo "Resize window"' 'command -c resize'
    bind -c resize ^] command
    bind -c resize j eval 'resize +1' 'command -c resize'
    bind -c resize k eval 'resize -1' 'command -c resize'
  • .vimrc

    " setting
    "文字コードをUFT-8に設定 set fenc=utf-8
    " バックアップファイルを作らない
    set nobackup
    " スワップファイルを作らない
    set noswapfile
    " 編集中のファイルが変更されたら自動で読み直す
    set autoread
    " 入力中のコマンドをステータスに表示する
    set showcmd
    
    " 見た目系
    " 行番号を表示
    set number
    " 現在の行を強調表示
    "set cursorline
    " アンダーラインを引く(color terminal)
    "highlight CursorLine cterm=underline ctermfg=NONE ctermbg=NONE
    " アンダーラインを引く(gui)
    "highlight CursorLine gui=underline guifg=NONE guibg=NONE
    " インデントはスマートインデント
    set smartindent
    " ビープ音を可視化
    set visualbell
    " 括弧入力時の対応する括弧を表示
    set showmatch
    " ステータスラインを常に表示
    "set laststatus=2
    
    " 検索系
    " 検索文字列が小文字の場合は大文字小文字を区別なく検索する
    set ignorecase
    set smartcase
    " 検索時に最後まで行ったら最初に戻る
    set wrapscan
    " 検索語をハイライト表示
    set hlsearch
    " ESC連打でハイライト解除
    nmap <Esc><Esc> :nohlsearch<CR><Esc>
    
    " タブを表示するときの幅
    set tabstop=4
    " タブを挿入するときの幅
    set shiftwidth=4
    " タブをタブとして扱う(スペースに展開しない)
    set noexpandtab
    set incsearch
    
    set softtabstop=0
    colorscheme molokai
    syntax on
    filetype plugin indent on
  • find

    find . -name "*.rb" -type f | xargs wc -l

  • sshポートフォワード

  • 多段SSHやポートフォワーディングを '.ssh/config' に書く

  • Time Capsuleをマウントする

    yum install cifs-utils
    sudo mount -t cifs -o username="[USER]",password="[PASSWORD]",sec=ntlm,uid=[UID],gid=[GID],vers=1.0 "//[IP]/Data" "[MOUNT DIR]"
  • systemctlの使い方。サービス一覧を見たい。起動・停止したい。Rocky,Alma,CentOS