Bootstrap FreeKB - Linux Commands - ls (list) --ignore
Linux Commands - ls (list) --ignore

Updated:   |  Linux Commands articles

Let's say the /tmp directory contains the following files.

/tmp/foo.txt
/tmp/bar.txt
/tmp/hello.txt
/tmp/world.txt

 

The ls (list) command with the -I or --ignore option can be used to list the contents of the /tmp directory, ignoring certain files. In this example, the foo.txt file will be ignored.

#]$ ls /tmp --ignore foo.txt
/tmp/bar.txt
/tmp/hello.txt
/tmp/world.txt

 

In this example, both foo.txt and bar.txt will be ignored.

#]$ ls /tmp --ignore foo.txt --ignore bar.txt
/tmp/hello.txt
/tmp/world.txt

 

However, when you want to ignore two or more files, this is a much better approach.

#]$ ls /tmp --ignore={foo.txt,bar.txt}
/tmp/hello.txt
/tmp/world.txt

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 2f2a57 in the box below so that we can be sure you are a human.