Help finding specific words in a file

Robert22

New Member
Joined
Aug 6, 2021
Messages
1
Reaction score
0
Credits
11
Hey im trying to see if the 'passwd' file contains the word "root"
how can this be done?

Many thanks in advance!
 


KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
10,682
Reaction score
9,174
Credits
88,682
Are you looking for:

Code:
sudo cat /path/to/file | grep root

sudo may or may not be required, depending on the file's permissions. It won't hurt if you use it.

Hmm...

You could check to see if it's stored where the system normally stores passwords, I think.. I'm pretty sure. I may have a bit more wine than normal in me, but it'd look like this:

Code:
sudo cat /etc/shadow | grep root
 

Tolkem

Well-Known Member
Joined
Jan 6, 2019
Messages
1,531
Reaction score
1,260
Credits
11,192
Hey im trying to see if the 'passwd' file contains the word "root"
Code:
grep root /etc/passwd
You might get something similar to this
Code:
grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
 


Top