#author("2021-02-19T09:49:28+00:00","default:hotate","hotate") #author("2023-10-22T09:48:57+00:00;2021-02-19T09:49:28+00:00","default:hotate","hotate") #contents &tag(macOS, コマンド); &tag(macOS,コマンド); * 全般 [#r2628e0b] - [[MacWiki - OSXの固有コマンド>http://macwiki.sourceforge.jp/wiki/index.php/OSX%E3%81%AE%E5%9B%BA%E6%9C%89%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89]] - [[データファイル処理に便利なUNIXコマンド>http://www.e.ics.nara-wu.ac.jp/~nogu/tips/unix_command.html#join]] - [[Mac OSバージョンを確認するコマンド - Qiita>https://qiita.com/masayuki_oguni/items/96b77b72e702b03b8f92]] sw_vers * zip [#ua207376] - [[Macでパスワード付きZIPファイルを作成!圧縮・解凍できない問題を解決!|ふりぶろぐ>https://furiblog.com/mac-command-zip-password]] よく紹介されているのがzipcloakコマンドを使ったやり方。 こちらの方法でやってみると次のようなwarningが出てしまい、うまく解凍できませんでした。 * mdfind [#id881ee5] - [[新・OS X ハッキング! (112) 知っているとファイル検索が変わる「mdfind」 | マイナビニュース>http://news.mynavi.jp/column/osxhack/112/]] mdfind -onlyin ~/Documents foo * find/xargs [#j47c92f6] - [[【コラム】新・OS X ハッキング! (28) 年末特別企画:ホームフォルダを大掃除 | パソコン | マイナビニュース>http://news.mynavi.jp/column/osxhack/028/index.html]] -- > findコマンドの検索結果をフルパスでヌル文字をくわえて標準出力へアウトプットし(「-print0」オプションの働き)、それを受けるxargsコマンドでは文字列の区切りにヌル文字を使用している(「-0」オプションの働き)。なぜこのような手間をかけるかというと、OS Xではファイル名にスペースを含むことが多いからだ。 $ find . -type f -name '*.log' -print0 | xargs -0 rm - [[いまさらxargsの便利さを主張してみる — ディノオープンラボラトリ>http://openlab.dino.co.jp/2008/02/20/133431188.html]] -- > レシピ1:カレントディレクトリ以下にある、最後の1文字が「~」である全てのファイルを「ls -la」する。 $ find . -name \*~ | xargs ls -la * xxd [#laded340] - バイナリファイルの16進数表示 % xxd foo.data * tidy [#a623f1be] - HTML/XML表示 $ curl http://twitter.com/statuses/user_timeline/OfficialTEPCO.xml|tidy -xml -utf8 -i * lipo [#wd63dd6d] - ファイルの種別を判別するコマンド(32bit/64bit) (2010/7/20) $ lipo -info /usr/bin/less Architectures in the fat file: /usr/bin/less are: x86_64 i386 * less [#jfa4d90f] - lessのオプション (2010/8/6) -- -M 全行数の情報を出力 -- -N 画面左端に行番号を出力 - [[Lessの便利な使い方>http://blog.daich.org/2015/04/06/less-tips/]] less -Sで起動またはless起動中に-Sr(-Sでモード切り替え、rで画面の再描写) * lsof [#b78f3949] - 特定のポート番号を使っているアプリケーション (2010/12/01) lsof -i:8888 * [[poppler]] [#yd849274] - [[Linux:pdftotextコマンドでPDFからテキストを抽出 - HiiHahWIKI - making some notes for... ->http://www.hiihah.info/index.php?Linux%EF%BC%9Apdftotext%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%A7PDF%E3%81%8B%E3%82%89%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%82%92%E6%8A%BD%E5%87%BA]] popplerというPDFソフトウェアのコマンドラインツールでPDFからテキスト抽出ができるらしいということが分かった * textutil [#q9072a45] - [[ASCII.jp:知る人ぞ知るテキスト形式変換コマンド「textutil」の謎を解く (1/2)|Apple Geeks>http://ascii.jp/elem/000/000/597/597604/]] $ textutil -info "お知らせ.docx" * unset [#kd1e8a75] - [[Linuxコマンド集 - 【 unset 】 変数の定義を解除する:ITpro>http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230919/]] 指定した変数や関数を削除する。 * WiFi [#a2b8a25d] - [[たまに必要になる、Wi-Fiや通知センターなどを再起動する方法 | Macとかの雑記帳>http://tukaikta.blog135.fc2.com/blog-entry-231.html]] $ networksetup -setairportpower en1 off $ networksetup -setairportpower en1 on * sudo [#b093315e] - [[Macで毎回sudoつけずにコマンドを実行する際のメモ (sudo, -sオプション) - いろいろ備忘録日記>http://devlights.hatenablog.com/entry/2014/11/04/135604]] * 処理完了の通知 [#w5afacd8] - [[ターミナルでの処理が終わったらDockアイコンを跳ねさせ未読バッヂを表示、警告音も鳴らす方法 - Macの手書き説明書>http://veadardiary.blog29.fc2.com/blog-entry-3998.html]] 処理するコマンド && tput bel * ファイル [#j84b6bdc] - [[[Linux] ファイルサイズを取得する。|Archive Redo Blog>http://ameblo.jp/archive-redo-blog/entry-10196055325.html]] -l オプション付きの ls コマンドでファイルの詳細情報を出力し、awk コマンドでバイト数のフィールドだけを抜き出して出力しています。 ls -l test.txt | awk '{print $5}' * 関連 [#fe3e2dc4] #taglist(tag=macOS^コマンド)