Skip to content

Instantly share code, notes, and snippets.

@sainu
Last active April 15, 2017 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sainu/19d3850572ef573075ded8fae0ba7d22 to your computer and use it in GitHub Desktop.
Save sainu/19d3850572ef573075ded8fae0ba7d22 to your computer and use it in GitHub Desktop.
便利なlinuxコマンド集

ファイル名検索

現在のフォルダ直下に存在する全てのファイル名を取得する

$ find . -maxdepth 1 -type f | sed "s!^.*/!!"

特定のファイル名を除いて取得
ex) hoge.rb以外のファイル名を取得

$ find . -maxdepth 1 -type f | sed "s!^.*/!!" | grep -vE "hoge.rb"

メモ:
-v: 否定
-E: 正規表現をエスケープなしで書ける

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment