Skip to main content

How to get current loggedin user on Mac via script


I won't waste time wiring details. This works as of today, but what will Apple do in future, only God knows. 
🤓 It's always suggested to run the command without variable to ensure it work, but you probably know that. 

CurrUser=$(echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }')

Comments

Popular posts from this blog

MAKING A FILE/FOLDER INVISIBLE

How to hide a file/folder using Terminal This is one of the greatest technique that I ever came across, I had to share my Mac in office and was curious about hiding confidential data. This was when I started exploring and finally came up with this solution. These commands are to be typed in Terminal. To make a file or folder invisible in Mac OS X Finder setfile -a V testfile.txt Here is goes, the file or folder is no longer visible via the Finder GUI, though it will be by Terminal. Your files are still there and you can find them via the command line and will show with an ls command. If you want your files and folders to be visible again, use this command: To make a file or folder visible again in Mac OS X Finder setfile -a v testfile.txt Now the file/folder will be visible again to the Finder, cool isn't it? Please Note: setfile is a command line utility included in Apple’s Developer Tools, which is a highly recommended optional install included on any Mac OS X install

ENTOURAGE TROUBLESHOOTING: CRASHES WHILE LAUNCHING - II

Entourage Crashing due to Fonts There are two fonts that are known to be one of the most popular reasons of Entourage crashing. The first one is Helvetica Fractions which is majorly responsible to cause problems, the second is Times Phonetic. In order to fix this issue, don't just disable these fonts in Font Book, but physically remove them from your system and try to launch Entourage again. Other discussed reasons are database , schedules and duplicate daemons .

MAC THEME FOR YOUR PC

How to give a trendy "Mac look" to your PC Have you ever imagined of giving a Mac OS X look to your PC? I am not talking about installing the Mac OS X on your machine, but this is just a theme and which will turn your PC into Mac and I can guarantee a non Mac user cannot identify which operating system are you working on. FlyakiteOSX is a transformation pack. It will transform the look of an ordinary Windows XP system to resemble the look of Mac OS X. The installer simply automates the process of replacing critical system files, setting registry tweaks, and installing extras such as cursors, sounds, visual styles, etc. Even the start up icon will be changed to grey Apple startup logo. Login screen will also look exactly as of Mac OS X. The startup tune will no longer be traditional Microsoft tune, it will be changed into Mac startup chime. Also the error tone, clicks, cursors, buttons & selectors on the browsers and all other applications will give a Mac look. Not j