LoginSignup
0
0

【Linux】lsコマンドでディレクトリのみ取得する方法

Posted at

ディレクトリのみ取得する方法

次のようにコマンドを実行するとディレクトリのみ取得できます。

ls -F [パス] | grep /

隠しファイルも含めて表示

ls -aF [パス] | grep /
サンプル
$ ls -F path/to/sample | grep /
app/
bin/
config/
db/
lib/
log/
public/
spec/
storage/
templates/
test/
tmp/
vendor/

$ ls -aF path/to/sample | grep /
./
../
.devcontainer/
.docker/
.git/
.vscode/
app/
bin/
config/
db/
lib/
log/
public/
spec/
storage/
templates/
test/
tmp/
vendor/

または、次のコマンドを実行します。

ls -d */
$ ls -d */
app/		node_modules/	public/		supabase/
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0