DEV Community

Le Vuong
Le Vuong

Posted on

Bash tutorial for popular commands: ls / find / grep

# List files in current folder
> ls
dir1/  dir2/  file1  file2  test.txt

# List files; -l for long format, -a for all (include system, hidden files)
> ls -la
total 0
drwxr-xr-x 1 Thu 197121 0 Jan 28 17:00 dir1/
drwxr-xr-x 1 Thu 197121 0 Jan 28 17:00 dir2/
-rw-r--r-- 1 Thu 197121 0 Jan 28 17:00 file1
-rw-r--r-- 1 Thu 197121 0 Jan 28 17:00 file2
-rw-r--r-- 1 Thu 197121 0 Jan 28 17:00 test.txt

# Find files, folder in current (.) and sub-folder matching specified name pattern
> find . -name "file*"
./file1
./file2

# Find files, match specified pattern file name, case insensitive
> find . -iname "file*"
./file1
./file2
./File3

# Use grep to filter result from other command

# grep filter output that include string "fil"
> find . | grep fil
./file1
./file2

# grep filter output that strat with string "fil" OR "dir"
> find . | grep -i "fil*\|dir*"
./dir1
./dir2
./file1
./file2
./File3
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more