Search

21 April, 2026

Useful Bash command list

These commands are useful when working on a Linux Bash environment that I found very useful.

To see all files/folders but exclude some files with extension

->  ls -d !(*.gz)

If you omit the "-d", it will also show listing of each directory it found.

Or 

-> ls -dls !(*.gz)
Where -d would omit deeper traverse into directories


To see only first few results ( say I just want to see latest few files ) 

-> ls -dls !(*.gz) | tail

If you want to see the same result but ordered by latest modified date:

->  ls -dls !(*,gz) -sort asc | tail

No comments:

Post a Comment