grep command examples Flashcards
1
Q
lines starting with the string “root”
A
cathy ~> grep ^root /etc/passwd
root:x:0:0:root:/root:/bin/bash
2
Q
lines ending in “:”
A
cathy ~> grep :$ /etc/passwd
news:x:9:13:news:/var/spool/news:
3
Q
check that PATH is exported in ~/.bashrc
A
cathy ~> grep export ~/.bashrc | grep ‘\
export PATH=”/bin:/usr/lib/mh:/lib:/usr/bin:/usr/local/bin:/usr/ucb:/usr/dbin:$PATH”