man page to ascii text
2008年08月08日 (linux)
command
% man man > test.txt % vim test.txt 制御文字が入っているので文字化けしたように表示される. % man man | colcrt - > test.txt % vim test.txt 普通のASCIIテキストとして表示される.
note
cf. % man colcrt
PR
my zshrc 080803
2008年08月03日 (linux)
source
### colors
local BLACK=$'%{\e[00;30m%}'
local BLUE=$'%{\e[00;34m%}'
local L_RED=$'%{\e[01;31m%}'
local PURPLE=$'%{\e[00;35m%}'
local RED=$'%{\e[00;31m%}'
local DEFAULT=$'%{\e[00;00m%}'
### set zsh options
setopt correct
setopt nobeep
setopt prompt_subst
setopt share_history
setopt extended_glob
### set env
PATH=~/bin:$PATH
export PATH
PROMPT=$RED'%(!.#.%%) '$DEFAULT
export PROMPT
BLOCKSIZE=K
EDITOR=vim
PAGER=less
export BLOCKSIZE EDITOR PAGER
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
export HISTFILE HISTSIZE SAVEHIST
LSCOLORS=exfxcxdxbxegedabagacad
export LSCOLORS
# LANG=ja_JP.UTF-8
# LANG=C
# LC_ALL=C
# LC_ALL=ja_JP.UTF-8
# export LANG
# export LC_ALL
### load zsh functions
zmodload zsh/mathfunc
### my aliases
# alias cat='cat -n'
alias cp='cp -i'
# alias gcc='gcc42'
alias h='history'
# alias h='history -20'
# alias h3='history -30'
# alias h5='history -50'
# alias h1='history -100'
alias l='ls -l'
alias less='less -N'
alias ls='ls -G --color=auto'
alias ll='ls -l'
alias mv='mv -i'
alias la='ls -A'
alias langc='LANG=C; export LANG'
alias langjp='LANG=ja_JP.utf-8; export LANG'
### compinit
autoload -U compinit
compinit
### login script
setterm -blength 0
~/.zshrc
serial numbered file(sh,bash,zsh)
2008年08月03日 (linux)
command
% touch {1..20}.txt # 1.txt〜20.txtの連番の空のファイルを作成
% rm {11..17}.txt # 11.txt〜17.txtのファイルを削除
note
tcsh, cshなどCシェル系で実行すると1..20.txtという名前のファイルが作成される.
find: patternA or patternB
2008年08月02日 (linux)
command
# find / -name "*bashrc" -or -name "*bash_profile" #1 # find / -name "*bashrc" -or -name "*bash_profile" | grep -v root #2 1./以下の"*bashrc"もしくは"*bash_profile"に一致したものを検索. 2.1+grepパイプ,文字列rootの出力行を除外.
note
cf. % man find % man grep % grep --help | grep invert invert : 〜を逆さまにする,ひっくり返す
mount usb flash memory
2008年08月02日 (linux)
command
# mount -t msdos /dev/sdb1 /mnt # mount # umount /mnt # unmount
note
USBフラッシュメモリーはsdb*, sda*に認識される. cf. % man mount % man umount