ユーザ用ツール

サイト用ツール


command

コマンド

だいたい同じだが、GNU系のLinuxとBSD系のMacOSXではオプション等が異なっていることがあるので、使えなかったら諦めてman読めや。  

rsync

指定のファイルだけ更新する

rsync -a --include=*/ --include-from=list.txt --exclude=* hoge@192.168.1.2:~/syncdir/ ~/syncdir/

更新対象のファイル一覧は –include-from オプションで指定する。–includeオプションで指定してもいいが、こういうケースでは対象が多くあると思われるのでファイルに記述するのが楽だろう。

時間がかかりそうならば、nohup付けてログをリダイレクト

nohup rsync -a --include=*/ --include-from=list.txt --exclude=* hoge@192.168.1.2:~/syncdir/ ~/syncdir/ > rsync.log

Ctrl-Zでサスペンドして

[1]+  停止                  nohup rsync -a --include=*/ --include-from=list.txt --exclude=* hoge@192.168.1.2:~/syncdir/ ~/syncdir/ > rsync.log

バックグラウンドジョブに

bg %1

nohup付け忘れた場合はジョブ番号指定してdisown

disown %1

date

フォーマット

date +%Y%m%d

エポック秒

date +%s

ファイルの更新日を取得

date -r ファイル名

フォーマット変換

date -d '2011/01/31 01:15:30' '+%Y-%m-%d %H:%M:%S'

指定日付の一ヶ月前を取得

date -d '2011/01/01 1 month ago' '+%Y-%m-%d'

dオプションはGNUのみ

gzip

圧縮ファイルを直接閲覧

gzip -c -d auth.log.2.gz | less 

cは元ファイルを削除せずに標準出力へ書き出するオプション

zcat auth.log.2.gz | less

file

ファイルの詳細を得る

$ file node
node: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
node (for architecture x86_64):	Mach-O 64-bit executable x86_64
node (for architecture arm64):	Mach-O 64-bit executable arm64

strings

バイナリに埋め込まれている文字列を得る

$ strings /usr/bin/java
@(#)PROGRAM:java_home  PROJECT:JavaApplicationSupport-326
JAVA_LAUNCHER_VERBOSE
java_home
JAVA_HOME
about to exec %s using JAVA_HOME="%s"
exec failed: %s
JAVA_VERSION
JAVA_ARCH
v:a:XFVh
version
arch
failfast
exec
verbose
help
Usage: %s [options...]
    Returns the path to a Java home directory from the current user's settings.
Options:
    [-v/--version   <version>]       Filter versions (as if JAVA_VERSION had been set in the environment).
    [-a/--arch      <architecture>]  Filter architecture (as if JAVA_ARCH had been set in the environment).
    [-F/--failfast]                  Fail when filters return no JVMs, do not continue with default.
    [   --exec      <command> ...]   Execute the $JAVA_HOME/bin/<command> with the remaining arguments.
    [-X/--xml]                       Print full JVM list and additional data as XML plist.
    [-V/--verbose]                   Print full JVM list with architectures.
    [-h/--help]                      This usage information.
Matching Java Virtual Machines (%ld):
    %s
JVMArch
# ... 以下略
command.txt · 最終更新: by nullpon