約 1,709,381 件
https://w.atwiki.jp/uyeee/pages/23.html
bash ターミナルでのbeep音を消す ~/.inputrc に、以下の内容を追記する。 set bell-style none
https://w.atwiki.jp/usapfrog/pages/17.html
条件分岐 elifが特徴。" [ ", " ] "の前後には半角スペースを忘れずに。 i=0if [ $i -eq 1 ]; then echo $ielif [ $i -eq 2 ]; then echo $ielse echo $ifi if 文と test コマンド[1] ループ for i in 1 2 3; do echo $i done i=0while [ $i -ne 10 ]; do echo $i i=`expr $i + 1`done 無限ループ while [ 1 -eq 1 ]; dosleep 10done 置換 後方置換 (拡張子変換など, %で最短・%%で最長マッチ) for f in `ls *.dat`; do mv $f ${f%.dat}.txt done 前方置換 (共通ファイルヘッダ変換など,#最短・##最長) for f in `ls a*.dat`; do cp $f b${f#a} done 特定のフォルダにある同名ファイル収集用ルーチン ls dats 1 /dev/null 2 /dev/nullif [ $? -ne 0 ] ; then mkdir datsfifor d in `ls -d folder*/`; do f=${d%/} cat $f/data.txt dats/${f}.datdone folder, data, catコマンドあたりは適宜変更する doskey (=unixのalias) win用texliveとかのplatexは基本sjisなので。引数をとるときには$*を追加する。 [init.bat] @echo offdoskey utex=platex --kanji=utf8 $* 毎回使うときは例えば C \bin\init.batとかに保存して、レジストリ(regedit.exe)を開き HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor HKEY_CURRENT_USER\Software\Microsoft\Command Processor のどちらかに、 AutoRun で文字列値を追加、値を C \bin\init.bat とする。 参考 [1]UNIX Linux コマンド・シェルスクリプト リファレンス [2]bashプログラミング/whileループ [3]シェルスクリプトの変数展開(評価)でパターンマッチ おまえのログ [4]炎のコマンドプロンプト入門
https://w.atwiki.jp/nopu/pages/18.html
ジャンル別UNIXコマンド一覧 システムコールなどの解説もあり。 (九大) bash,awk,sed スキルアップ輪講 Linux便利帳 sh は bash csh は違う系列 3つのクオーテーション $var 無くても変わらない。スペースを含むときに1つの文字列として認識させるのに使う。 $var メタキャラクタとか変数指定子$の働きを殺す。 `ls -a` コマンドを囲んで,その出力を値に持つ。パイプでは対応できない複雑な引数のときに活躍。 Ex. バッククオーテーションは grep などと連携して威力無限大 tar hoge.tar.gz `ls -F | egrep [^*/~]` メタキャラクタ *の役割が正規表現と違うので注意! * 任意文字列 ? 任意1文字 [a-z] 指定された中から任意の1文字 {hoge,hage,tako} 指定された文字列の中から任意のどれか 正規表現 sed, grep, perl, ruby などで使用 * は,直前の文字の0回以上の繰り返しになる。 ^ 行頭 $ 行末 [...] いずれか1文字 [^...] 禁止文字 or検索 grep one|two|three grep -e one -e two -e three マッチしたものを表示しない grep -v .eps$|.o$|~$ 所有者と権限 所有者とパーミッションの表示 ls -l 実行パーミッション chmod 755 hoge 所有者の変更 chown owner_name file_name chown -R owner_name dir_name プロセス管理 ジョブというのは,例えばパイプとかでつないで1機能をなしているプロセスのまとまりのこと。 ^Z による中断とか, 付きの実行とかは,要するに bg してることになる。 間違って ^Z で Suspended してしまったのを復活させたい。 ^Z # 中断 jobs # まず落ち着いてジョブの番号を調べる。 [1] - Suspended ほげほげ [2] + Suspended (tty output) emacs なんとか 思い切って殺す kill %2 復活させる fg %1 シェルスクリプトを通常のプログラムのように実行させる hoge.sh #!/bin/sh ←スクリプトを実行するプログラムのパスを書いておく。 (スクリプト) 実行方法 chmod u+x hoge.sh ←実行属性を付ける。 ./hoge.sh Cf. コマンドから実行するときは #! も chmod も不要。 sh hoge.sh のみでおk 変数 代入 var=val 参照 echo $var 実際には,$ は変数の内容で置き換える演算子 スクリプト実行時にもらった変数 $1,$2,...で指定できる。 ちょっと削る fpath=foo/var/baz echo ${fpath%/*} - 後ろから match する min 部分を削る。 - foo/var echo ${fpath%%/*} - 後ろから match する max 部分を削る。 - foo echo ${fpath#*/} - 前から match する min 部分を削る。 - var/baz echo ${fpath##*/} - 前から match する max 部分を削る。 - baz 制御 改行はむやみやたらに入れられない。セミコロンで置き換えられる。 機能語との間のスペースも必ず「1つ」必要なので注意! if文 if 式 then なにがし else それがし fi Ex. ディレクトリが無ければ作る if [ ! -d hoge/hage]; then mkdir -p hoge/hage; fi for文 for target in list do command done Ex. .txt を .doc に一括変更 for file in *.txt; do mv $file ${file%.txt}.doc; # %なんとか ってのは,マッチした尻を削る命令 done 注. ファイル名の一括変更はコマンド一発 rename *.txt *.doc 一括操作 階層ディレクトリおっぴろげ ls -R 複数の下位ディレクトリに散在する cpp と hpp から検索 grep hoge */*pp hoge.* を hage.* に変える。 for F in *; do mv $F ${F/hoge/hage}; done ←${変数名/置換対象/置換文字列}の順番 複数ファイルに含まれる文字列 hoge を hage に置換 1. grep hoge *pp で確認 2. for F in *; do cp $F $F.bak; sed -e s/hoge/hage/g $F.bak $F; done (.bakはあとで消す。.bak を経由しないと上手くいかなかった!) 印刷 片面白黒(標準) lpr lpr -Pps1 両面白黒 lpr -Pps1d lpr -C,dup 両面白黒 短辺綴じ lpr -Pps1t lpr -C,dup,tumble 片面カラー lpr -Pcps1 両面カラー lpr -Pcps1d lpr -Pcps1-duplex 両面カラー 短辺綴じ lpr -Pcps1t マウント マウントしたらアンマウントを忘れずに! umount/mnt/hoge CD/DVD HDD(IDE devices) mount /dev/hdb1 /mnt/hdd Image(.iso) mount -o loop ***.iso /mnt/image cd /mnt/image == アーカイブ 圧縮 tar zcvf hoge.tar.gz (圧縮するターゲット列挙) zip hoge.zip (圧縮するターゲット列挙) 解凍 tar の解凍先はデフォルトでカレントディレクトリなので、 1. 解凍したい場所に移動してからファイルを指定する。 2. -C 解凍先 オプションを漬ける。 tar zxvf hoge.tar.gz bzip2 -dc hoge.bz2 unzip hoge.zip tar jxvf hoge.tar.bz2 lha e hoge.lzh ファイル操作 ファイルの種類を調べる。 file hoge ファイルの詳細な情報を調べる。 stat hoge 登録されているコマンドのパスを調べる。 which hoge 画像フォーマット変換 Imagemagicを使う。ただしコマンド名は convert Ex. epsをpngに変換 convert hoge.eps hage.png 詳しくはココなど参照 ネットワーク 誰が入ってるか見る who cygwinから入る startx してから入る sshで接続 ssh [ユーザ名]@むにゃむにゃ ( login ) ruptime で空いてるマシン確認 ssh [マシン名] で入る ( 作業ディレクトリに移動 ) screen に入ることを忘れずに! 自宅からうp ssh でリモートに入ってしまわないこと! scp [ローカルのファイル] [ユーザ名]@[アドレス] [コピー先のファイル名] 入出力 redirection 入出力先を変えること。 tako.txtに出力 ./a.out tako.txt ./a.out tako.txt # こっちは追加モード hage.datから入力 ./a.out hage.dat 応用. ファイルコピー cat original.txt copy.txt 標準エラー出力先の変更 ./a.out 2 err.log STDOUTとSTDERRを同じファイルに出力 ./a.out output.log pipe 左から順に実行される。 左からの出力を右の入力に渡していく。 command1 | command2 | command3 | ... 現在地を表示 pwd 時間計測 time command real 実行にかかった実時間 user ユーザーモードだった時間(種々の演算やメモリアクセス) sys カーネルモードだった時間(システムコール) rem. real = user + sys + ディスクI/Oの時間 情報の表示 画面描画の詳細を表示 xrandr Xの設定を表示 cat /etc/X11/xorg.conf システムの構成が分かる。 メモリ使用状況を表示 free top (リアルタイム) 現在ログインしている人を表示 who カレントディレクトリのアドレスを表示 pwd CPUの情報を表示 cat /proc/cpuinfo ( /proc/ には,他にも meminfo などがある。) ホスト名を表示 hostname IPアドレスを調べる ifconfig システムの情報を表示 dmesg カーネルの情報を表示 uname -a デバイスの情報を調べる lspci ←PCIの情報 lsusb ←USBの情報 インストール yum yum install hogehoge sourceからインストール ./configure --prefix=/usr/local; make; su make install パスを通す ~/.bashrc を書き換える。 一時的な方法 export PATH=/usr/local/hoge $PATH 全ユーザーに適用 /etc/profile.d/hoge.sh を作る。 ライブラリパスは別に作る export LD_LIBRARY_PATH=/usr/local/lib オリジナルコマンドを作る alias hoge= echo hage hoge → hage .bashrc にでも書けば毎回使える。
https://w.atwiki.jp/naobe/pages/35.html
Unix/Linuxに戻る kshの機能をほぼ包含しているなあ testでの条件判定 条件 意 味 -z string 文字列の長さが0で真。 -n string string の長さが0より大きければ真。 -e file ファイルが存在すれば真。 -f file 通常のファイルで真。 -c file file が存在し、キャラクタスペシャルファイルであれば真。 -s file fileが存在し、サイズが0より大きければ真 -d file file が存在し、ディレクトリであれば真。 -h file or -L file file が存在し、シンボリックリンクであれば真。 string1 = string2 文字列string1が文字列string2と等しければ真。 string1 != string2 文字列string1が文字列string2と等しくなければ真。 arg1 op arg2 引数を数値とみなして大小を比較する。 オペレーション 項目 説明 -eq 等しい -ne 等しくない -lt 小さい -le 以下 -gt 大きい -ge 以上 算術式 パラメーターを正しく指定してください。の中で使われる。 算術式では、シェル変数を使うときに$は不要。 演算子 c言語と同じ。優先順は上から下。同じ行内では、左から右。 項目 説明 id++ id-- 変数を評価後、increment/decementする ++id --id - + ! ~ ** * / % + - = = 比較 == != ビット単位の AND ^ ビット単位の 排他的OR | ビット単位の OR || expr?expr expr = *= /= %= += -= = = = ^= |= expr1 , expr2 ()を使うと、優先順位が変わる。()が最優先。 条件式 [[]]の中で使われる。単語分割とパス名展開は [[ と ]] の間の単語に対しては行われません。チルダ展開、パラメータと変数の展開、算術式展開、コマンド置換、プロセス置換、クォート除去は実行されます。 下記の組み合わせを使える。優先順は上から下。 項目 説明 (expression) ! expression 否定 expression1 expression2 expression1 || expression2 expressionは、testコマンドの条件式を使える。testコマンドの条件式に加えて、 == などが使える。 【例】 if [[ ! $a == aaa || $b != bbb $c == ccc ]] 単語分割 IFSで区切って単語に分割する。空の引数("", )は削除されずに残る。 引数をワイルドカード展開しない 変数をダブルクォートで囲む 【例】 #!/bin/ksh FILEPATTERN=$1 find . -name "$FILEPATTERN" ジョブ制御 viを実行中に作業を中断し、シェルで作業をし、またviを再開するときに便利。 項目 説明 CTRL+Z フォアグラウンドジョブを一時停止する jobs -l jobの一覧を表示する fg [jobspec] jobspecで指定したジョブをフォアグラウンドで実行する。jobspecを省略した場合は最近実行したバックグラウンドジョブ/一時停止ジョブをフォアグラウンドで実行する。 jobspec 説明 %N ジョブ番号がNのジョブ %string stringで始まるジョブ %?string stringを含むコマンドのジョブ %+ または %% 最後に実行されたバックグラウンドジョブ %- 最後の1つ前に実行されたバックグラウンドジョブ local 変数1[=値1] [変数2[=値2] ...] bash拡張機能。関数の中で有効。スコープを関数と子供の関数に制限する。 【コードサンプル】 aaa() { local i j i=1 echo "before i=$i" bbb echo "after i=$i" } bbb() { i=2 } aaa echo "関数外 i=$i" 【実行結果】 before i=1 after i=2 関数外 i= $(コマンド) bash拡張機能。コマンド置換。`コマンド`と同じ。kshと同じ。 フローコントロール if コマンド; then elif コマンド; then else fi for 変数 in リスト do done for 変数 : コマンド引数を順々に処理する。 for 変数 in * : ファイルを順々に処理する。 for 変数 in $* : コマンド行引数を順々に処理する。 ※リストは複数の文字列をIFS(Internal Field Separator)環境変数の最初の文字で区切ったもの。IFSはデフォルトでは、スペース、タブ、改行。 for (( expr1; expr2; expr3 )) do ... done 【例】 for (( i = 0; i 10; i++ )) do echo $i done while コマンド do ... done until コマンド do ... done コマンド実行後の終了ステータスが0なら真。 【使用例】 #!/bin/sh i=0 while [ $i -ne 10 ] do echo $i i=`expr $i + 1` done 関数 使う前に定義する。 引数は、コマンドの引数と同様の方式で与える。 【使用例】 func() { echo $1 echo $2 echo $3 } func 1 2 3 return Nで、終了ステータス Nを返す。 expr シェルの中で算術演算を行う。 num=`expr $a + $b` 演算子: + - * / % 特別なシェル変数 項目 説明 $# 位置パラメータの数 $- シェルのオプション $? 最近実行したシェルの終了状態 $$ 現在のシェルのプロセス番号 $* シェルの引数のリスト。展開する時に"$1 $2 ..."と展開する。 $@ シェルの引数のリスト。展開する時に"$1" "$2" ...と展開する。 パラメータの展開 はない場合は、変数が未使用の場合に適用される。 がある場合は、null(VAR="" or VAR=)の場合と未使用の場合に適用される。 項 目 説 明 ${parameter -word} $parameterが未設定のときに一時的にparameter=wordとする。次のステップでは、$parameterは未設定のままとなる。 ${parameter =word} $parameterが未設定のときにparameter=wordとなる。以後、$parameterは、wordの値を保存する。 ${parameter +word} $parameterが設定されているときにparameter=wordとなる。設定されていないときは未設定のまま。 ${parameter#word} $parameterとwordを先頭からパターンマッチング(最短一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter##word} $parameterとwordを先頭からパターンマッチング(最長一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。【例】base=${1##*/} 引数1からディレクトリを除いたものを返す ${parameter%word} $parameterとwordを末尾からパターンマッチング(最短一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter%%word} $parameterとwordを末尾からパターンマッチング(最長一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter/patern/string} $parameterとpaternをパターンマッチング(最長一致パターン)する。マッチしたら、$parameterのpaternをstringに置き換えて置換する。置き換えるのは最初にマッチした部分のみ。 ${parameter//patern/string} $parameterとpaternをパターンマッチング(最長一致パターン)する。マッチしたら、$parameterのpaternをstringに置き換えて置換する。置き換えるのはマッチした全ての部分。【例】${p//[0-9]/} 変数pの数字をすべて削除する。 ${paraneter offset length} $parameterのoffset位置(0から始まる)からlength長を返す ${parameter =$word}の例 foo=456 word=foo parameter= echo "parameter1 ${parameter =$word} " echo "parameter2 $parameter" | V parameter1 foo parameter2 foo ${parameter -$word}の例 foo=456 word=foo parameter= echo "parameter1 ${parameter -$word} " echo "parameter2 $parameter" | V parameter1 foo parameter2 パターンマッチ置換の例 parameter=fooabbab echo "parameter1 ${parameter##fo*a} " echo "parameter2 $parameter" | V parameter1 b parameter2 local name1=value1 name2=value2 ... 関数の中で使われると、関数の中でだけ有効な変数nameを作成し、valueで示される値を変数に代入する。 タブをスペース/スペースをタブに変換する あるディレクトリ以下の対象ファイルのタブをスペースに変換する $ find . -name \*.java -exec expand.sh {} \; 【expand.sh】 FILE=$1 TAB_NUM=$2 if [ x$TAB_NUM = x ]; then TAB_NUM=8 fi expand -t $TAB_NUM $FILE ${FILE}_tab mv ${FILE}_tab $FILE スペースをタブに変換する場合は、unexpandコマンドを使う カレントディレクトリ下のファイルから文字列を検索する find.sh #!/bin/ksh FILEPATTERN=$1 PATTERN=$2 find . -name "$FILEPATTERN" -type f -exec grep.sh "$PATTERN" {} \; grep.sh #!/bin/ksh PATTERN=$1 FILE=$2 RESULT=`egrep $PATTERN $FILE` if [ $? = 0 ]; then echo $FILE echo "$RESULT" fi 【使用例】 find.sh \*.c ap_prelinked_modules
https://w.atwiki.jp/damedev/pages/13.html
トップページ サーバー bashの設定 目次 目次 方法 方法 % chsh -s /usr/local/bin/bash if [ -f $HOME/.bashrc ]; then source $HOME/.bashrc fi
https://w.atwiki.jp/keiplus/pages/173.html
bash Tips bash tips 本項は書きたての記事です。正確な情報は公式サイト、公式ドキュメント、記載の参照サイトでご確認ください。 許可がありません。」を表示しない find / -name hoge 2 /dev/null
https://w.atwiki.jp/maisenakajima/pages/32.html
Reserved Bourne shell variables Variable name Definition CDPATH A colon-separated list of directories used as a search path for the cd built-in command. HOME The current user s home directory; the default for the cd built-in. The value of this variable is also used by tilde expansion. IFS A list of characters that separate fields; used when the shell splits words as part of expansion. MAIL If this parameter is set to a file name and the MAILPATH variable is not set, Bash informs the user of the arrival of mail in the specified file. MAILPATH A colon-separated list of file names which the shell periodically checks for new mail. OPTARG The value of the last option argument processed by the getopts built-in. OPTIND The index of the last option argument processed by the getopts built-in. PATH A colon-separated list of directories in which the shell looks for commands. PS1 The primary prompt string. The default value is " \s-\v\$ ". PS2 The secondary prompt string. The default value is " ". Reserved Bash variables Variable name Definition auto_resume This variable controls how the shell interacts with the user and job control. BASH The full pathname used to execute the current instance of Bash. BASH_ENV If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script. BASH_VERSION The version number of the current instance of Bash. BASH_VERSINFO A read-only array variable whose members hold version information for this instance of Bash. COLUMNS Used by the select built-in to determine the terminal width when printing selection lists. Automatically set upon receipt of a SIGWINCH signal. COMP_CWORD An index into ${COMP_WORDS} of the word containing the current cursor position. COMP_LINE The current command line. COMP_POINT The index of the current cursor position relative to the beginning of the current command. COMP_WORDS An array variable consisting of the individual words in the current command line. COMPREPLY An array variable from which Bash reads the possible completions generated by a shell function invoked by the programmable completion facility. DIRSTACK An array variable containing the current contents of the directory stack. EUID The numeric effective user ID of the current user. FCEDIT The editor used as a default by the -e option to the fc built-in command. FIGNORE A colon-separated list of suffixes to ignore when performing file name completion. FUNCNAME The name of any currently-executing shell function. GLOBIGNORE A colon-separated list of patterns defining the set of file names to be ignored by file name expansion. GROUPS An array variable containing the list of groups of which the current user is a member. histchars Up to three characters which control history expansion, quick substitution, and tokenization. HISTCMD The history number, or index in the history list, of the current command. HISTCONTROL Defines whether a command is added to the history file. HISTFILE The name of the file to which the command history is saved. The default value is ~/.bash_history. HISTFILESIZE The maximum number of lines contained in the history file, defaults to 500. HISTIGNORE A colon-separated list of patterns used to decide which command lines should be saved in the history list. HISTSIZE The maximum number of commands to remember on the history list, default is 500. HOSTFILE Contains the name of a file in the same format as /etc/hosts that should be read when the shell needs to complete a hostname. HOSTNAME The name of the current host. HOSTTYPE A string describing the machine Bash is running on. IGNOREEOF Controls the action of the shell on receipt of an EOF character as the sole input. INPUTRC The name of the Readline initialization file, overriding the default /etc/inputrc. LANG Used to determine the locale category for any category not specifically selected with a variable starting with LC_. LC_ALL This variable overrides the value of LANG and any other LC_ variable specifying a locale category. LC_COLLATE This variable determines the collation order used when sorting the results of file name expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within file name expansion and pattern matching. LC_CTYPE This variable determines the interpretation of characters and the behavior of character classes within file name expansion and pattern matching. LC_MESSAGES This variable determines the locale used to translate double-quoted strings preceded by a "$" sign. LC_NUMERIC This variable determines the locale category used for number formatting. LINENO The line number in the script or shell function currently executing. LINES Used by the select built-in to determine the column length for printing selection lists. MACHTYPE A string that fully describes the system type on which Bash is executing, in the standard GNU CPU-COMPANY-SYSTEM format. MAILCHECK How often (in seconds) that the shell should check for mail in the files specified in the MAILPATH or MAIL variables. OLDPWD The previous working directory as set by the cd built-in. OPTERR If set to the value 1, Bash displays error messages generated by the getopts built-in. OSTYPE A string describing the operating system Bash is running on. PIPESTATUS An array variable containing a list of exit status values from the processes in the most recently executed foreground pipeline (which may contain only a single command). POSIXLY_CORRECT If this variable is in the environment when bash starts, the shell enters POSIX mode. PPID The process ID of the shell s parent process. PROMPT_COMMAND If set, the value is interpreted as a command to execute before the printing of each primary prompt (PS1). PS3 The value of this variable is used as the prompt for the select command. Defaults to " #? " PS4 The value is the prompt printed before the command line is echoed when the -x option is set; defaults to " + ". PWD The current working directory as set by the cd built-in command. RANDOM Each time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number generator. REPLY The default variable for the read built-in. SECONDS This variable expands to the number of seconds since the shell was started. SHELLOPTS A colon-separated list of enabled shell options. SHLVL Incremented by one each time a new instance of Bash is started. TIMEFORMAT The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the time reserved word should be displayed. TMOUT If set to a value greater than zero, TMOUT is treated as the default timeout for the read built-in. In an interative shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt when the shell is interactive. Bash terminates after that number of seconds if input does not arrive. UID The numeric, real user ID of the current user. 参考資料 Bash Guide for Beginners Version 1.11 Last updated 20081227 Edition
https://w.atwiki.jp/karaiknowledge/pages/69.html
bashrcの設定 シェル変数をプロンプトで用いる。 $USER … ユーザ名 $HOSTNAME … ホスト名 $TERM … 端末名 $PWD … カレントディレクトリ 例 PS1= [$USER($TERM)$HOSTNAME $PWD]$ [sakura(vt100)host /home/karai]$ Edited By karai 2011年01月18日 origin
https://w.atwiki.jp/bastian/pages/25.html
Finish Blow A powerful cleave over enemies Available after 2 chain attacks Lv damage Consumes spirit Cooldown time 1 250% 6 0 2 265% 8 0
https://w.atwiki.jp/myfavoritepcsettings/pages/145.html
目次 ↑ 概要 URL インストール 設定 .bashrcの設定 タグ 概要 シェル URL インストール 設定 .bashrcの設定 変数PS1を変更して、プロンプトに多くの情報を色分けして表示する(このケースでは2行に分けている) PS1= \n\[\033[32m\]\u@\h \[\033[m\]\[\033[36m\]\w\[\033[m\]\n\[\033[31m\]\t\[\033[m\]\[\033[33m\][\!]\$\[\033[m\] PS1の中で使われる主な記号の意味は以下の通り: \! ヒストリ番号 \t タイムスタンプ \u ユーザ名 \h ホスト名 \w カレントディレクトリ(フルパス) \W カレントディレクトリ(最後の1階層だけ) エスケープシーケンスの配色は以下の通り: [30m 黒 [31m 赤 [32m 緑 [33m 黄 [34m 青 [35m マゼンタ [36m シアン [37m 白 [1;31m (太字)赤 [1;32m (太字)緑 [1;33m (太字)黄 [1;34m (太字)青 [1;35m (太字)マゼンタ [1;36m (太字)シアン [1;37m (太字)白 標準の色が暗すぎてみづらい場合は、「太字」のエスケープシーケンスに変えることで解消することがある。これは、ボールドフォントを使えないターミナルエミュレータでは色の明暗の区別で代用することがあるため(例:PuTTYの標準の配色、CygwinやmsysGitのコンソール、など)。 標準の文字コードをEUC-JPにして、それをlessで文字化けさせたくない場合: export JLESSCHARSET=japanese export LESSCHARSET=utf-8 export LANG=ja_JP.EUC-JP export LC_CTYPE=ja_JP.EUC-JP alias less= lv タグ *nix