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
8,110
Reaction score
6,960
Credits
65,851
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,484
Reaction score
1,209
Credits
10,801
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
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Staff online

Members online


Top