Display the username and passwords fetched from etc/passwd and etc/shadow files in a single file using cut and paste commands [closed]

Solution 1:

Passwords are not stored in the system, so I assume you mean password hashes. Password hashes are not stored in passwd, but both are in shadow.

Did you want the username and password associated with each other? Because if you do, there is no guarantee that passwd and shadow are in the same order, so the paste command can't associate them. You should use join for that rather than paste.

The following might be what you want. If not, edit your question to be more clear. (This doesn't use passwd since it doesn't have anything in it you asked for that isn't in shadow.)

sudo awk -F: '{print $1,$2}' /etc/shadow