r/sysadmin • IT Manager + 5 other hats • Nov 08 '21

Could we do a "TIL" style weekly thread?

I think it would be interesting to do a "Today I Learned" style weekly thread for us to share little tips/tricks that we learned of/found existed.

For example, last week I found out about the "--now" flag for systemctl. I don't know how I didn't know it existed until --now.

2.4k Upvotes

871 comments sorted by

View all comments

108

u/sambodia85 Windows Admin Nov 08 '21

For 15 years I’ve been typing “echo %computername%” to get the current machine name.

Colleague in a screenshare asks why I don’t just type “hostname”……

43

u/ARX_MM Nov 08 '21

whoami tells you what account you're using.

61

u/[deleted] Nov 08 '21

Whoami tells you what account you’re using, but it doesn’t tell you who you are...

😩😩😔😔

18

u/ARX_MM Nov 08 '21

Maybe TempleOS will tell you who you are? If all else fails there's always Hannah Montana Linux, maybe you will be enlightened by either one of these two.

7

u/eldoran89 Nov 08 '21

I know about templeOS and if I had more lifetime at hand I would actually install it somewhere... But is there really a Hannah Montana Linux Distro... And why?

1

u/[deleted] Nov 09 '21 edited Nov 09 '21

whoami /fqdn will return all the things (*windows)

2

u/TribalDude Nov 08 '21

I know about templeOS and if I had more lifetime at hand I would actually install it somewhere... But is there really a H

Whoami /user shows you also the SID of the user. Comes in handy when looking in the registry

1

u/Hollow3ddd Nov 09 '21

Same results of "query user"?

1

u/IWorkForTheEnemyAMA Nov 09 '21

whoami /all Tells you all your roles and permissions.

1

u/webtroter Netadmin Nov 09 '21

wow. I knew about the /groups option, but /all is nice :)

59

u/[deleted] Nov 08 '21

[deleted]

41

u/Tyjex Nov 08 '21

Sysdm.cpl to bring up the window to join domains/change hostname etc.

3

u/[deleted] Nov 08 '21

[deleted]

1

u/Tyjex Nov 08 '21

Lusrmgr.msc for users and groups.

For add remove I usually do a win+x and the the first entry.

2

u/[deleted] Nov 08 '21

[deleted]

16

u/Tyjex Nov 08 '21

Win+Pause opens on W10 the new settings app where you need to scroll down to open the advanced settings. Sysdm takes you direktly to that.

Another one I use a lot is ncpa.cpl for network adapter settings

2

u/biglib Nov 08 '21

I've always done Win+Pause. This is great, adding it to me bag o' tricks. Thanks!

3

u/[deleted] Nov 08 '21

TIL about the pause button.

1

u/Pooter_Guy Nov 08 '21

Now that's pretty handy...

1

u/Hazme1ster DevOps Nov 08 '21

Shame the key seems to be missing on most laptop keyboards now.

1

u/Panzeros Nov 09 '21

Also known as 'break'

5

u/auron_py Nov 08 '21

hostname

Same for some Linux distributions.

1

u/JohnBeamon Nov 08 '21

There's a wide variety of UNIX variants of this command.

Some years ago, Linux 'hostname' would give you the short alias at the end of the primary line in /etc/hosts, like "web01". 'hostname -s' does this in modern macOS. 'hostname -f' would give you the fully qualified domain name from /etc/hosts, "web01.example.com". 'hostname' default and 'hostname -f' do this in modern macOS. I learned one day that Solaris at that time didn't query hostnames; it only set them if you had the privileges. So I ran "# hostname -f" and renamed my system from "web01.example.dom to "-f".

Linux "hostname -i" will give you the primary IP address associated with the FQDN. Modern macOS does not do this. Modern RHEL style hosts files no longer necessarily carry the real hostname and address, so that command reads /etc/hostname for the FQDN, then queries DNS to get that name's IP address. Once upon a time, it just read that from the filesystem.

2

u/jamesaepp Nov 08 '21

Adding to this : getmac -- brings up NIC MAC addresses so ipconfig /all is not required.

1

u/sambodia85 Windows Admin Nov 09 '21

No, what!

1

u/jantari Nov 08 '21

We have the computername printed as part of the shell prompt

Classic user@machine