0

I would like to remove all the entries in /etc/securetty file except console, tty[0-9] and vc/[09].

~]# cat /etc/securetty
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
vc/10
vc/11
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
ttyS0
ttysclp0

I tried egrep command to collect the output. but I don't know how to get only 1-9 "tty or vc\"

~]# egrep "console|vc/|tty" /etc/securetty

Please help me get the output like below

~]# cat /etc/securetty
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
2

Almost there!

egrep 'console|vc/[0-9]$|tty[0-9]$' /etc/securetty

A general tip is to use single quotes rather than double quotes unless you need variables to be substituted.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.