example_of_initial_ubuntu_settings
This is an old revision of the document!
Table of Contents
Example of initial Ubuntu settings
First, you should install Ubuntu on your machine or through WSL2
Install ubuntu-24.04 from WSL2
> wsl --install Ubuntu-24.04 --location "<Location you want to put ext4.vhdx in>" --name <distribution_name> --web-download ex) > wsl --install Ubuntu-24.04 --location "F:\pctr_wsl_ubuntu" --name pctr_wsl_ubuntu --web-download
Setting example of .gitconfig .gitignore
$ cat ~/.gitconfig [user] name = pctr email = pctresearch@pctresearch.com [core] editor = code [merge] tool = meld [mergetool "meld"] cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED" [mergetool "meld"] trustExitCode = false [difftool] Prompt = false [difftool "meld"] cmd = meld "$LOCAL" "$REMOTE"
$ cat ~/.gitignore # Ignore all * # Unignore all start with dot files !.* # ignore all start with dot dirs .*/
Configure Git to Use Meld for Diffs in Ubuntu
$ sudo vimn /usr/bin/git-meld-diff -- #!/usr/bin/python3 import sys import os os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5])) --
$ sudo chmod +x /usr/bin/git-meld-diff
# configure git to use the new script when we run git diff.
$ git config --global diff.external git-meld-diff
$ git init
Customize .bashrc .profile
$ cgit diff 8175285fb6420ddd2bd23df18e7f8c9c74e9e830..HEAD .bashrc diff --git a/.bashrc b/.bashrc index b488fcc..a369f62 100644 --- a/.bashrc +++ b/.bashrc @@ -8,6 +8,16 @@ case $- in *) return;; esac +blk='\[\033[01;30m\]' # Black +red='\[\033[01;31m\]' # Red +grn='\[\033[01;32m\]' # Green +ylw='\[\033[01;33m\]' # Yellow +blu='\[\033[01;34m\]' # Blue +pur='\[\033[01;35m\]' # Purple +cyn='\[\033[01;36m\]' # Cyan +wht='\[\033[01;37m\]' # White +clr='\[\033[00m\]' # Reset + # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth @@ -57,7 +67,8 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' diff --git a/.bashrc b/.bashrc index b488fcc..a369f62 100644 --- a/.bashrc +++ b/.bashrc @@ -8,6 +8,16 @@ case $- in *) return;; esac +blk='\[\033[01;30m\]' # Black +red='\[\033[01;31m\]' # Red +grn='\[\033[01;32m\]' # Green +ylw='\[\033[01;33m\]' # Yellow +blu='\[\033[01;34m\]' # Blue +pur='\[\033[01;35m\]' # Purple +cyn='\[\033[01;36m\]' # Cyan +wht='\[\033[01;37m\]' # White +clr='\[\033[00m\]' # Reset + # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth @@ -57,7 +67,8 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='${debian_chroot:+($debian_chroot)}'${grn}'\u@\h'${clr}':'${blu}'\w\n'${clr} else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi @@ -115,3 +126,23 @@ if ! shopt -oq posix; then . /etc/bash_completion fi fi +alias sudo='sudo ' +alias cpu10='ps -L aux | sort -nr -k 3 | head -10' +alias mem10='ps -L aux | sort -nr -k 4 | head -10' +alias lsmount='mount |column -t' +alias sshk='ssh -p 65342 kan@win10kan2' +alias sshuk='ssh -p 65342 kan@ubuntukan' +alias vimn='vim.nox -u ~/.vimrc ' +alias ggit='export GIT_EXTERNAL_DIFF=git-meld-diff && git ' +alias cgit='unset GIT_EXTERNAL_DIFF && git ' + +function git_branch() { + if [ -d .git ] ; then + printf "%s" "($(git branch 2> /dev/null | awk '/\*/{print $2}'))"; + fi +} + +PS_GIT='$(git_branch)' +#PS1=${cyn}${PS_GIT}${clr}${PS1}${pur}'\n'${clr}'\$ ' +PS1=${cyn}${PS_GIT}${clr}${PS1}${pur}''${clr}'\$ '
$ cgit diff 8175285fb6420ddd2bd23df18e7f8c9c74e9e830..HEAD .profile diff --git a/.profile b/.profile index d89ea5a..8192c32 100644 --- a/.profile +++ b/.profile @@ -25,3 +25,12 @@ fi if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi +# add PATH +export PATH="$PATH:/mnt/c/Users/kan/AppData/Local/Programs/Microsoft VS Code/bin" +export PATH="$PATH:/mnt/c/Windows" +export PATH="$PATH:/mnt/c/Windows/System32" +export PATH="$PATH:$HOME/.local/bin"
$ cgit diff 8175285fb6420ddd2bd23df18e7f8c9c74e9e830..HEAD .vimrc diff --git a/.vimrc b/.vimrc index 5d7f70c..cf7612d 100644 --- a/.vimrc +++ b/.vimrc @@ -36,7 +36,7 @@ endif " If using a dark background within the editing area and syntax highlighting " turn on this option as well -"set background=dark +set background=dark " Uncomment the following to have Vim jump to the last position when " reopening a file @@ -49,13 +49,14 @@ endif " The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. "set showcmd " Show (partial) command in status line. -"set showmatch " Show matching brackets. +set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching "set smartcase " Do smart case matching "set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and :make "set hidden " Hide buffers when they are abandoned "set mouse=a " Enable mouse usage (all modes) +set number
example_of_initial_ubuntu_settings.1739988464.txt.gz · Last modified: 2025/02/20 03:07 by jianwu