ターミナルでのファイル操作

Tuyoshi Akiyama
Jul 10, 2017 · 2 min read

以下四つのコマンドについては、理解済みのため、説明は省略します。

  • cp — copy files and directories
  • mv — move or rename files and directories
  • rm — remove files and directories
  • mkdir — create directories

Wildcardsについて理解したこと

コマンドでのファイル操作において、ある特定のファイルを、素早く探し出す便利な文字です。

イメージで言ったら、正規表現でデータを特定の文字列で絞る感じです。

  1. * →全ての文字列を意味します。
    例)b* bで始まる全ての文字
  2. ? → 全ての文字列、一文字を意味します。
    例)abc?? abcで始まり、それに二文字が追加された名前
  3. [characters] → カッコ内の文字列の、どれか一文字を意味します。
    例)*[aeiou] 最後が aeiouのどれか一文字で終わる名前
  4. [!characters] → カッコ内の文字列以外の、どれか一文字を意味します。

また、3の中ではPOSIX Bracket Expressions が使える。これも

正規表現(regular expression pattern)のようなもの。詳細は以下リンク参照。

    Tuyoshi Akiyama

    Written by

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade