101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 54


Which wildcards will match the following filenames? (Choose two.) ttyS0 ttyS1 ttyS2

Show Answer
Correct Answer: BDE

To match the filenames ttyS0, ttyS1, and ttyS2, wildcards must cover the patterns in these filenames. The pattern tty?[0-5] matches all given filenames because the question mark matches any single character and the range [0-5] allows for numbers 0 through 5. The pattern tty[Ss][02] also matches the filenames because it explicitly includes 'S' or 's' followed by either 0 or 2. Other options like ttyS[1-5] exclude 0, tty*2 is too broad, and tty[A-Z][012] is invalid for this scenario, as it includes uppercase letters other than 'S' and 's'.

Discussion

7 comments
Sign in to comment
iwkno6Options: BD
Jul 28, 2021

B and D are correct. A doesn't include 0, C is definitely wrong and E doesn't include 1.

sugishoOptions: BD
Nov 3, 2020

[root@centos7 ~]# touch ttyS0 ttyS1 ttyS2 [root@centos7 ~]# [root@centos7 ~]# [root@centos7 ~]# [root@centos7 ~]# ls tty?[0-5] ttyS0 ttyS1 ttyS2 [root@centos7 ~]# ls tty[AZ][012] ls: cannot access tty[AZ][012]: No such file or directory

hawkmoon
Nov 11, 2020

you forgot the - in the [A-Z]

glorofarzOptions: BC
Jul 11, 2020

well, if i do ls /dev/tty?[0-5] on debian/centos i get 28 results including e.g. /dev/ttyS63 so suffice it to say i am a bit confuseled.... (yet i found the same answer in another language test with the same answers)

lancOptions: BE
May 27, 2020

For this one, tty?[0-5], question mark represents if the proceeding character is present or not. So I think the answer is correct if ttyS?[0-5] was an option

cast7omadrid1
May 30, 2020

We're talking about wildcars (globbing) not regular expressions.

jegga
May 28, 2021

A, B, and D is the answer. They all can match the files

CuriousLinuxCat
Jul 24, 2021

A. ttyS[1-5] A will not work because it is missing a 0 in the [1-5]. If it was ttyS[0-5], then the answer would be valid.

M_ukesh8Options: BD
Aug 14, 2023

A can not be considered because the endings are : 012 So the correct ans are B, D

NinymoOptions: BD
Mar 24, 2024

Answer: BD