Intro to Unix / Linux cd to the /etc directory. Execute the following command. l
ID: 3905217 • Letter: I
Question
Intro to Unix / Linux
cd to the /etc directory.
Execute the following command.
ls -l au*.[mn]*
The output is the following:
-rw-r--r-- 1 root root 675 Jan 24 19:04 auto.master
-rw-r--r-- 1 root root 524 Mar 22 2012 auto.misc
-rwxr-xr-x 1 root root 1374 Mar 22 2012 auto.net
This is exactly the output I was hoping for.
What function are the [ ] performing?
A.) They look good and balance the command string.
B.) The uniquely match the m and n characters to ensure only the desired output os generated.
C.) They neutralize the m and n characters to hide the output
D.) They were used by mistake and have no meaning.
Explanation / Answer
Ans: B)
Consider an example that a directory named "etc" and there are lots of files in it.
Suppose the expression to list the files a.txt and b.txt would be ls -l [ab].txt:
So this will serach for a.txt and b.txt in the file list.
Here its [mn]* which means it starts with m and wild card * or with n and wild card *.
The wildcard * suggests anything.
So the whole expression ls -l au*.[mn]* Which means name starts with au and any wildcard before "." and [mn]* means starting with m or n and follwed by any wild card
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.