Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2912

[Ubuntu18.04]を使い始めて半年経ったので設定を紹介!!

$
0
0

Ubuntu18.04をインストールしたらすること。

はじめに

こんにちは。
Ubuntu18.04をメインPCで使い始めて半年経ちました。
半年間の中でUbuntuにどのようなソフトを入れたりカスタマイズをしたかを示そうと思います。

対象読者

  • Linuxに興味のある人
  • メインPCでUbuntuを使っている人。
  • Ubuntuって色々不便だと思っている人。

virtualboxの場合(メインOSの方はスキップ)

guest adition(virtualbox)

$ sudo apt install linux-headers-$(uname -r) build-essential dkms
$reboot

ホストキーの変更

  • メニューバーから,ファイル→環境設定→入力→仮想マシンと進んでいき,「ホストキーの組み合わせ」の「ショートカット」を選択して任意のキーを押すとそれがホストキーとして設定されます。右シフトがおすすめ ******

terminalカラーの設定

git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized/
./install.sh
  • ./install.shを実行すると使用するカラースキームの選択が表示される。
  • dark alternativeを選択し、1のunnamedを選択。その後追加パッケージをダウンロードする。しかし、この状態だと、文字色が見づらかったのでターミナルのpleferrenceから変更した。

Mac風のkey mappingを導入

Mac(jis)だとかな,英数を使って半角全角を切り替えることができます。
個人的にはこれが気に入っているのでUbuntuのキーマッピングを変更しました。

  1. 画面右上の入力モードをクリックする。
  2. tool→properties
  3. keymap styleのCustomizeをクリック
  4. それぞれの変換と無変換が3箇所ずつあるので変換をactivateIMEに無変換をdeactivateIMEに設定する。
  5. 誤入力防止の為に、katakana,hiraganaもそれぞれactivateIMEに設定する。(Let's noteの場合にはキーが小さいため。) > この設定後も無変換、変換としての機能が使える場合がある。(Vimでは使えない) ******

デスクトップの設定

GNOME Tweaks

  • CtrlとCapsを入れ替えるには Keyboard&mause→Additional Layout Option→Ctrl Position→Caps Lock as Ctrlを選択
  • emacs input Keyboard&Mouse→emacs input
  • Top Bar→Battery percentage
  • Top Bar→Clock→Date
  • ゴミ箱をデスクトップから非表示にする。
  • Mac風の配列については/memo/pc/ubuntumemo参照

emacs input

  • gnome Tweaksを起動→キーボードとマウス→emacsinput
  • C-j,C-sは通常通りであることが確認できた。
  • C-aがカーソル移動になっているため、全選択はShift-Ctrl-aなどで代用しようか ### 画面サイズの設定
  • GNOME Tweaks→Fonts→4つの項目すべてを変更する。
  • これだけだとターミナルの形が変になったのでTerminalのeditタブからPreferrencesで変更した。 ### 名前の変更 ターミナルに表示されるユーザー名の変更は設定→Detailsから変更可能 ### アイコンのサイズの変更 ファイルマネージャを開く→三→アイコンのサイズの変更 ### fontsizeの変更 Tweaksを開いて、fontを選択 ## gnomeの拡張機能 参考参考2拡張機能の解説
  • デスクトップ環境とは 見た目と使い勝手を統一するもの。GNOME,Unity,KDEなどがある。

gnome tweaksに拡張機能の初期設定

gnome-shell --version
sudo apt install gnome-shell-extensions

webブラウザからGNOMEシェルの拡張機能をインストール

  1. open weatherなどをダウンロードするページにいって推奨アドオンをブラウザにインストール
  2. ネイティブコネクタをインストール
sudo apt install chrome-gnome-shell
  1. ブラウザで拡張機能が提供されているページに行ってoffをonにする。

導入した拡張機能

テーマの変更

  • gnome-tweaksの拡張機能テーマの変更をオンにする。
sudo apt install arc-theme
sudo add-apt-repository ppa:dyatlov-igor/materia-theme
sudo apt update
sudo apt install -y materia-gtk-theme

アイコン

sudo add-apt-repository ppa:dyatlov-igor/la-capitaine
sudo apt update
sudo apt install la-capitaine-icon-theme

open weather

  • 設定からlocationを変更し、単位を℃にする。

gnome-shell-extensions-windows-navigator

  • オーバービュー使用時にキーボードで切り替え可能にする。

Dash to dock

  • dockの位置を変更したり、常時表示をやめる
  • shows on all monitorのチェックをつける。
  • Appearance→Customize the dash color→青の真ん中の色,黒の真ん中
  • Appearance→Customize windows counter indicator→Dots > opacityをいじるとバクる場合がある。

 Dim On Battery Power

  • 電源接続時とバッテリ駆動時でそれぞれ明るさを設定できる。これで割と問題は解決できた気がする。 ### Alternative tab
  • Alt-tabの切り替える単位をアプリケーションからウインドウ単位にする。
  • 同一アプリケーションを複数開いている場合には有効だが、ブラウザのタブ切り替えには使えない。

Native Window placement

  • オーバービューの表示の仕方を変更
  • あんま好きじゃない

Caffeine

  • auto suspendの有効無効をクリック一つでできるようになる。

CPU Power Manager

  • CPUのクロック数を計測したり、静音モード,ハイパフォーマンス,電源節約などに変更可能。
  • 動作はintelのみ

Refresh Wifi Connections

  • wifiのリフレッシュボタンの作成

Hide Activities Button

  • 左上に表示されるactivityボタンの削除

Remove Dropdown Arrows

  • ドロップダウンの三角マークを消してシンプルにする。

Workspaces to Dock

  • 仮想ディスプレイを使いやすくする。
  • 出っぱなしになるのが面倒でオフにしてしまった。 ### pompodoro タイマーの一つ。以下でダウンロードできる。
$ sudo apt install -y gnome-shell-pomodoro

詳細設定は通知センター→preferanceから変更できる。


bashrcの設定

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' #作用なし
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# 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 dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias ls='ls -F --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
#------------added by tomita------------
alias matrix='cmatrix -ab'
#alias python='/usr/bin/python3'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias open='xdg-open'
alias screenshot='gnome-screenshot'
alias lock="xdg-screensaver lock"
alias lhS='ls -lhS'
alias lsl='clear && ls'
alias upower='upower -i /org/freedesktop/UPower/devices/battery_BAT1'
alias dd='echo "dd is not available"'
alias chmod='chmod --preserve-root'
alias chown='chmod --preserve-root'
PATH=$PATH":/home/tomita/bash"
CDPATH=:/home/tomita/memo/
alias chrome='google-chrome-stable &'
alias firefox='firefox &'
alias vim='/home/tomita/bash/vim'
#alias jupyter-notebook='conda activate base && jupyter-notebook'
export WWW_HOME="https://www.google.com/"
alias cd='cd '
alias dl='/home/tomita/Downloads'
alias pict='/home/tomita/Pictures'
alias gs='git status'
alias mkprg='mkprg.bash'
alias fc='fc -e'
alias winekd='wine ~/app/kindle-for-pc-1-17-44183.exe'
alias vpngate='cd ~/app/vpngate-with-proxy && ./run tui && cd -'
alias torb='cd ~/app/tor_browser && ./start-tor-browser.desktop'
#---------------------------------------

#------------anaconda導入後に自動挿入------------
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/tomita/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/tomita/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/tomita/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/tomita/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
#----------------------------------------

# joke command
#fortune
#-----------------------------------------

# OpenMPI
MPIROOT=/usr/local/openmpi-2.0.1
export PATH=$MPIROOT/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPIROOT/lib
export MANPATH=$MANPATH:$MPIROOT/share/man

#-----プロキシを調べるprintenvを使うための設定-----
export http_proxy="http://proxy_server:port/"
export https_proxy=$http_proxy

バッテリー関連

バッテリーの持ちをよくする

powertopをいれる電力消費を最適化することができます。

sudo apt install powertop
sudo apt install tlp tlp-rdw
sudo powertop               overviewで消費電力がワット数で表示される。Tunablesで電力が最適化しているかどうかが見られる。ひとつひとつ変更するのは面倒なので以下のコマンドを実行
sudo powertop --auto-tune
sudo tlp start 自動で最適化が起動する。

バッテリーの寿命を伸ばす

sudo vim /etc/default/tlp
以下を編集する
START_CHARGE_THRESH_BAT0=80
STOP_CHARGE_THRESH_BAT0=90

KindleをUbuntuで使う。

KindleはLinuxのサポートがされていないのでwineというWindowsエミュレータを使ってKindleを使う。

wine

  • Ubuntuでwindowsの一部ソフトウェアを動かすことができる。
sudo apt update
sudo apt -yV upgrade
sudo apt install wine-stable
wine --version
winecfg
>windows8.1を選択

Kindleをダウンロード

この際に、バージョン1-17より新しいものは動作しない可能性がある。

バックアップ関連

TimeShift

  • ubuntuで使えるタイムマシンである。
sudo add-apt-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install timeshift

Viewing all articles
Browse latest Browse all 2912

Trending Articles