Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
There is less than 12 hours left to vote in the 2015 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I was wondering what command should I use to find duplicate names in a file. This is a descent sized file and I need to make sure that there are no duplicate names throughout the whole file. Thanks again for any help. Here is was I have so far and Im going to try using the sort command.
You can use the sort command with -u option to get unique records from a file.
Say you have a file called "list" with the following contents:
You can see bob is in there twice. If you run "sort -u list" it will show only:
You could redirect that into a new file move it over the original.
Of course if you don't have the entire line the same on every occurrence the sort -u won't exclude it. So if your list had:
Both lines would be output because the second field is different.
Well the file contains only names but and I just want to make sure there are no duplicates. I dont think the sort command would work because the duplicates would still be there it just wouldnt show them. I want to see if there is any so I can later delete the duplicates.
A better question is can the /etc/passwd file actually contain duplicate login names? I don't think it can, unless added manually, duplicate uid/gid sure, but I don't think the useradd/adduser command will let you dup the name.