/tmpディレクトリ
「/tmpと/var/tmpの違いについて述べよ」・・・インフラエンジニアの入社試験の問題に出てきそうですね。 さて単純な解答ですが、システム的なことを言えば以下あたりです。(RHEL)
/tmp /var/tmp 再起動時にファイルが削除される 再起動しても消えない 10日間アクセスが無い場合削除 30日間アクセスが無い場合削除 どちらもディレクトリ配下はtmpwatchコマンドにより監視されファイルの削除が組み込まれています。
FHSに何か書いているのかなと思ったら特に強制はしていないみたい
The /tmp directory must be made available for programs that require temporary files.
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.
http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.
Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.
http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE
あと、/var/tmpの使い道がよくわからなかったがyumがキャッシュ用に使っていたりするのか。vimのスワップファイルも書き込めないと.->~/tmp->/var/tmp->/tmpの順に出力される。