How to find login user with the largest account

Hello. I'm looking to put together a bash script that can do two things: (1) determine the shortname of the user with the largest account in /Users and (2) look up their full/long name. I'm going to use this script to help identify who the user on a computer and while I know that's possible that a sometime-user may have a larger account than the normal-user on any given computer, the results of a script should be sufficient in most cases for my needs.
I'm not sure the best way to around this. I know that I can use "du -m -d1 /Users" as root:
root on torchwood
[ ~ ]$ du -m -d1 /Users
157 /Users/admin
128 /Users/johndoe
70890 /Users/dancollins
21746 /Users/Shared
92920 /Users
I know that I can also use "dscacheutil -q user" to get a full list of all users on a system.
How can I get both the short and long name of the user with the largest account in the /Users folder?

We're running JAMF Recon for inventory and my supervisor wants to create a report that lists the primary user of the Mac... assuming that the largest user account may be the primary user. In this case, disk space is not the issue, the top admins simply would like to be able to associate names with individual machines. This isn't the most elegant way to do it and it's not fool-proof, but it'll be correct more often than not, which they're satisfied with.
Can I ask one more question? Using your script, I've started testing with one building and on a number of Mac, the "admin" (shortname) account is turning out to be the largest account. Is there a way to exclude the admin account from consideration?
Thanks...

Similar Messages

  • HT1529 how to find my iphone with the serial number

    hi
    could you please tell how to find my iphone with the serial number ?

    Sorry, there is no way to do that.
    What To Do If Your iDevice or Computer Is Lost Or Stolen
    iPhone, iPod Touch, and iPad
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)
    Mac Computer
           Find My Mac can be used from Find My Phone at iCloud.com and via Find
           My Phone on your iDevice.
          The following is third-party anti-theft software:
               1.  STEM 2.1
               2.  MacPhoneHome 3.5
               3.  MacTrack 7.5.0
               4.  VUWER 1.7
               5.  Sneaky Bastar* 0.2.0
               6.  Undercover 5.1.1
               7.  LoJack for Laptops
               8. Hidden 2.0

  • How to find an EXIT with the Include name ?

    Hi everybody
    If i have an Include name (like ZXMLUU16) , how can i find the FM Exit or the program where this include is used ?
    (NOTE: If i use SE38 and 'Where used' option , this
           only tell me 'Include ZXMLUU16 not found in
           selected search area')
    Thanks
    Frank

    I don't think there is a way to find that out, particularly if the include is not yet created. Typical with function module user exits is that, even though you see the line INCLUDE ZXMLUU16 statement in the function module code, the include itself is not created yet. Only when you double click, you will be creating it and then your 'where-used' should work.
    You just have to go by a hunch based on the name itself. Unn is a typical naming convension used for function module includes. So, I will take a wild guess that this include is in a function module that is in the function group XMLU. So if you look at this program SAPLXMLU and do a 'Find' 'In main program', you will see that the statement is in EXIT_SAPLMLSP_030.

  • Spotlight - how to find RTF files with the query language (kMDItemKind,etc)

    Hi folks. I'm trying to come up with a string that will find all RTF files.
    There are many strings for other docs -- like Microsoft Word is
    kMDItemContentType == "com.microsoft.word.doc"
    But I am trying to create one that will find all RTF files. There doesn't seem to be a kMDItem command for extension or anything, and if I type "com.nisus.writer" I'd just be guessing. And I only want to include RTF files.
    I'm probably missing something obvious, but I'm a complete non-programmer (obviously).
    Thanks.

    That's a partial solution, but it would be very helpful if one could somehow get the pathname onto the clipboard.  Being able to see the pathname is a lot less useful than being able to use it.

  • How to Find out Users with Hardware Phones

    Hi,
    Is there anyway that i can create a report that which Users are using IP Phones (Physical) and which users are using soft Phone (Lync Client on PC).
    Regards
    Usman Ghani
    Usman Ghani - MCITP Exchange 2010

    Hello Usman,
    If you have a monitoring server, you can see the Physical Phones.
    Access your monitorin server by:
    http://<ip_monitoring>/Reports or
    http://<ip_monitoring>/Reports_<Instance_Name>
    LyncServerReports > Reports Home Page and then click IP Phone Inventory Report and you will see all the physicals phone.
    If you don't have a monitoring server, access this...
    http://www.mcse.eti.br/Installing-and-Configuring-Monitoring-Server.html
    “Vote As Helpful” and/or “Mark As Answered” - Thiago Mendes da Silva - MCSE Communication - ITIL v3 Foundation - http://www.mcse.eti.br

  • How to find a data with the minimum value I get without using sub query

    Currently, I manage to get a record by using subquery to find the minimum number, eg:
    SELECT TAccTrn.ASysCde
    FROM TAccTrn
    WHERE TAccTrn.AAccTrnNum=(SELECT Min(TAccTrn.AAccTrnNum)
    FROM TAccTrn, TDbtSchCltDtl
    WHERE TDbtSchCltDtl.ASrcRefId=TAccTrn.ASrcRefId
    AND TDbtSchCltDtl.ASrcRefSubId=TAccTrn.ASrcRefSubId
    AND TDbtSchCltDtl.ASrcRefSeq=TAccTrn.ASrcRefSeq)
    Is there any more idea without using the subquery?

    Hi ,
    What about using an in-line view and the row_number () analytic function...????
    Here is an example....
    SQL> select * from emp;
    EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
    7369 SMITH      CLERK      7902 18/12/1980     800,00               20
    7499 ALLEN      SALESMAN   7698 20/02/1981    1600,00    300,00     30
    7521 WARD       SALESMAN   7698 22/02/1981    1250,00    500,00     30
    7566 JONES      MANAGER    7839 02/04/1981    2975,00               20
    7654 MARTIN     SALESMAN   7698 28/09/1981    1250,00   1400,00     30
    7698 BLAKE      MANAGER    7839 01/05/1981    2850,00               30
    7782 CLARK      MANAGER    7839 09/06/1981    2450,00               10
    7788 SCOTT      ANALYST    7566 18/04/1987    3000,00               20
    7839 KING       PRESIDENT       17/11/1981    5000,00               10
    7844 TURNER     SALESMAN   7698 08/09/1981    1500,00      0,00     30
    7876 ADAMS      CLERK      7788 21/05/1987    1100,00               20
    7900 JAMES      CLERK      7698 03/12/1981     950,00               30
    7902 FORD       ANALYST    7566 03/12/1981    3000,00               20
    7934 MILLER     CLERK      7782 23/01/1982    1300,00               10
    14 rows selectedUsing a solution like the one you don't want ...(a subquery) i would write....
    SQL> select ename from emp
      2    where hiredate=(select min(hiredate) from emp)
      3  /
    ENAME
    SMITHWhereas , using an in-line view....
    SQL> select ename from
      2   (
      3    select ename,row_number() over(order by hiredate asc) row_num from emp
      4    )
      5  where row_num=1
      6  /
    ENAME
    SMITHIs it acceptable...????
    Regards,
    Simon

  • I had to restore all the files on my pc using carbonite.  I reinstalled iTunes and was able to find my music with the help of Apple support.  How do I find my podcasts?

    I had to restore all the files on my pc using carbonite.  I reinstalled iTunes and was able to find my music with the help of Apple support.  How do I find my podcasts?

    This helped, I restored them, but when I go to iTunes they are not there.    Is there another step?

  • How to map the bulk users with the required  roles in portal at one time

    Hi,
    Would anyone tell me how to map the bulk users with the required roles in portal at one time?

    Thanks for all the reply.
    <b>I need to assign 1 or 2 group to n((eg) 1000)number of users</b>
    I tried the first option like
    [group]
    gid=
    gdesc=
    user=
    Thr problem with this is I could n't put more no of users in the notepad.
    I would be able to put only 150 users in the single line of notepad. If it goes to next line it is not working.
    I tried creating seperate notepad but in Import it says "exists"
    I'm not sure about LDAP. Would anyone explain me the best approach to do this.

  • I have an iMac and iPhone 4s i also have ringtones as an app i am also an match user with the cloud how can i get a ringtone to appear in my library to use on my phone

    i have an iMac and iPhone 4s i also have ringtones as an app i am also an match user with the cloud how can i get a ringtone to appear in my library to use on my phone

    Oh nice, there's a PassKeeper application for the iPhone and iPad.  Simply install it and it should talk you through steps, otherwise their website is probably a great place to check.
    http://itunes.apple.com/us/app/passkeeper/id405021740?mt=8
    I really like the application 1Password, and it works across all the products, Mac, PC, iPad, iPhone.

  • How to use glob search with the wildcard in command find?

    How to use glob search with the wildcard in command find?
    I want to find any file its names begin with "readme" string using command find. Why the following command cannot work?
    $find /usr/share/doc -name readme*
    However, the following commands can work?
    $find /usr/share/doc -name readme\* or
    $find /usr/share/doc -name readme'*'
    I want to know: After using the “\” or ' ', why the wildcard do not become a character "*"?(still a metacharacter).
    Another question:
    I want to find any file its names begin with "readme*" string using the command find.What command should I use?

    I want to know: After using the “\” or ' ', why the
    wildcard do not become a character "*"?(still a
    metacharacter). The backslash is known as an escape character. It means 'use the character value of the next character, not the special meaning' It is used in a lot of places such as command line, global regular expression patterns, and editors such as vi.
    In a typical shell, the splat (*) expands to all file names before passing the file names to the current command. So a \* sequence tells the shell to pass a *, not a list of file names, to the command.
    Demo - OpenSuSE Linux 10.3
    - I have a bunch of files. Let's list those that end in grid. Create one called *grid, and list again
    pops@fuzzyVM:~/pops> ls 
    a  b  c  startgrid  stopgrid
    pops@fuzzyVM:~> ls *grid
    startgrid  stopgrid
    pops@fuzzyVM:~> ls \*grid
    ls: cannot access *grid: No such file or directory
    pops@fuzzyVM:~> touch '*grid'
    pops@fuzzyVM:~/pops> ls
    a  b  c  *grid  startgrid  stopgrid
    pops@fuzzyVM:~/pops> ls *grid
    *grid  startgrid  stopgrid
    pops@fuzzyVM:~/pops> ls \*grid
    *grid
    pops@fuzzyVM:~/pops>In the above, how would I remove the file *grid, and only that file?
    Another question:
    I want to find any file its names begin with
    "readme*" string using the command find.What command
    should I use?What were the results of the two versions you tried? And why?

  • I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    It may be due to Continuity
    The following quote is from  Connect your iPhone, iPad, and iPod touch using Continuity
    Turn off iPhone cellular calls
    To turn off iPhone Cellular Calls on a device, go to Settings > FaceTime and turn off iPhone Cellular Calls.

  • How to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    how to get list of active users with the details like samaccountname, name, department, job tittle, email in active directoy?

    You can use third party software True Last Logon 2.9.You can export the file in excel for report creation.You can use the trial version this will achieve what you are looking for.
    True Last Logon displays the following Active Directory information:
    --Users real name and logon name
    --Detailed account status
    --Last Logon Date & Time
    --Last Logon Timestamp (Replicated value)
    --Account Expiry Date & Time
    --Enabled or Disabled Account
    --Locked Accounts
    --Password Expires
    --Password Last Set Date & Time
    --Logon Count
    --Bad Password Count
    --Expiry Date
    --You can also query for any other attribute (Example: Description, telephone Number, custom attibutes etc)
    Refer the below link for trial version:
    http://www.dovestones.com/products/True_Last_Logon.asp
    Best Regards,
    Sandesh Dubey.
    MCSE|MCSA:Messaging|MCTS|MCITP:Enterprise Adminitrator |
    My Blog
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • How to start Integration server with the user XISUPER

    Hi,
    How to start Integration server with the user XISUPER?
    Regards,

    Mahesh,
    In the post installation document, under Creating User XISUPER,
    I see the following,
    1.You must now log on to the Integration server host with the user XISUPER, to switch the initial password to a valid password.
    2.You must restart the J2EE engine to transfer the user creation to the J2EE immediately.
    I am unable to proceed here.Can you please help me to resume the post installation steps ?
    Thanks,

  • There are multiple users with the same display name

    Hi,
    We have a user and when she get an item assigned to her she sees the following alert:
    "There are multiple users with the same display name USERNAME and at least one of them does not have read permissions to some of the files"
    Now I looked in the database and when I run the following query with the username:
     SELECT     
         [ProviderDisplayName]  
        ,[DisplayName]  
        ,[HasDisplayName]  
        ,[Domain]  
        ,[AccountName]  
        ,[UniqueUserId]  
        ,[LastSync]  
      FROM [Tfs_Configuration].[dbo].[tbl_Identity] where displayname like '%USERNAME%'  
    Then I get 2 same usernames back, How can I get rid of one of them ? When I access TFS trough the portal I only find 1 occurence of this user.
    We use VS2013 and TFS2013 update 4
    Best regards

    Hi DSW,  
    Thanks for your post.
    In your query result, please check if these two users have the same Account Name. if they are two different Account Name in result, it indicate there’s two users have the same display name in your AD, please check that two users’ information in
    your AD. We suggest change one user’s display name in AD.  
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Will iTunes 10 & iTunes 11 work together? If not, how do I combine 2 libraries with the same account?

    My 2005 iMac (which can't be updated to Snow Leopard or Mountain Lion and so is stuck with iTunes 10) has thousands of my songs, over 80GB of music mostly from CDs and other uploads/downloads.  In 2008 we got an iMac for the family room; somehow although we have the same iTunes account for that computer, we started fresh with no tracks, and built up its own library for family use.  Now we've bought two iPhones which aren't recognized by the '08 iTunes/Mac OS, so I want to upgrade the '08 iMac (the only one I can) and I have the Snow Leopard software to do so.
    But I'm concerned that once the two computers have different versions of iTunes, I will lose the ability to home-share the music library from the '05 iMac on the '08 iMac, and because of that I won't be able to store any of my older Mac's tracks on the iCloud or access them on my iPhone.  (Of course I don't want to have to pay for 80GB+ on the cloud!)
    Has anyone got two versions of iTunes on two computers with the same account and are you able to home-share together and access tracks on your iPhones from an older version?
    What do Apple users recommend?  I'm thinking my best bet might be to combine the two libraries, which as I said are on the same account, but I don't know how to go about doing this.  How much time would it take with 80GB?  (I could probably do without 15% or 20% of those tracks, but it's still a lot, I don't know if it's instantaneous or if it uploads each track one at a time, I can imagine that taking two days.)
    The older Mac's tracks, the 80GB, are the ones I really want, it took years to collect and upload all that, finding photos for some of the more esoteric albums/songs, etc.  The newer Mac only has 2.5GB in its iTunes and I guess it wouldn't be the worst thing if I had to reload those, if the 80GB library had to wipe out the 2.5GB one.
    Thanks so much to anyone who can help me!  If I can start this tonight and have it run overnight (if necessary) that'd be great, otherwise I'm hoping I can get this done Sunday.  By the way, technologically, I have the '05 iMac hooked up to a 1st Gen Time Capsule and the '08 iMac getting WiFi from that.

    Thank you for replying.  Both of the accounts are Admin accounts.  The Libraries are kept in the user/music/itunes/itunes media folder on each account.  However, I do use multiple iTunes Libraries on my Account1.  One of the Libraries I use in Account1 is on a separate internal HD.  However, the other Libraries I use in Account1 are stored in user/music/itunes/itunes media folder on the main HD (which hosts both Account1 and Account2).  It doesn't seem to matter whether I am using an iTunes Library on an external drive or the main drive in Account1, I still get the same problem: only account1 library will load.  AppleTV sees that the Account2 Library is there, but it won't load it.

Maybe you are looking for