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,564
Reaction score
7,313
Credits
69,644
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,504
Reaction score
1,241
Credits
10,990
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
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online

Members online


Top