FreshMacApps Terminal Tutorial
Using the Command-Line to find Account Identity
Welcome back to FreshMacApps Tutorials. Today we will be covering commands that you can use in the Terminal to discover your identifying information for the account you are currently logged in as.
This first command allows you to discover the account name which you are currently logged in as. Although it is possible to use this for nefarious purposes(like finding out more information on an account you should not have access to), it has real legitimate uses. In systems with multiple users, which you need to switch between it can get easy to lose your bearing. To double-check type the following command into your command-line interface:
host: ~ your_user$ whoami
Additionally, if you find yourself in an unfamiliar place in the filesystem, or if you lose trace of where you are you can always type in the following command to get your current directory:
This command stands for “present working directory” and it will print out where you are in the filesystem.
To find out which user owns the permissions on files in your current directory you can type in:
This will print out the files in the directory, plus the user/group owners of those files.
drwx------ 37 users user 1258 Oct 1 23:01 Dropbox
-rw-r--r-- 1 root user 17920 Oct 7 09:55 Desktop DD
-rw-r--r-- 1 root user 113090 Oct 3 21:28 Desktop
drwx------ 9 user user 306 Jul 25 22:05 Documents
drwx------ 53 user user 1802 Jun 11 17:38 Library
drwx------ 50 user user 1700 Sep 10 12:44 Movies
drwx------ 20 user user 680 Jul 8 20:22 Music
drwx------ 25 user user 850 Sep 20 22:52 Pictures
Okay, that’s relatively basic, but what about more advance information IP or MAC addresses. To display this information type the following into your Terminal window:
Now I won’t put a full sample output but I will show you know how to figure out which address is which. There were will be several readouts listing different information. Look for the en0 option. In the option en0 there should be listed ether and inet (not inet6). They should look something like:
There will also be a broadcast IP which is the full IP listed at the end of the inet readout. Another trick you can use to get all your hardware port addresses is to enter the following into your command-line interface:
The readout from that command will look something like the following.
Hardware Port: Bluetooth
Device: Bluetooth 0
Ethernet Address: N/A
Hardware Port: Ethernet
Ethernet Address: 1b:o1:1x:B1:z3:bx
Hardware Port: Bluetooth PAN
Ethernet Address: N/A
Well there you have it. These are a few ways to find out the identity of the account you are logged in as. If you have any questions or comments please feel free to contact us, or leave a comment below.
Last updated byat .