Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uname instead of hostname #7

Closed
wants to merge 1 commit into from
Closed

uname instead of hostname #7

wants to merge 1 commit into from

Conversation

t-h2o
Copy link
Contributor

@t-h2o t-h2o commented Aug 27, 2023

uname in much more portable between MacOS
and differents GNU/Linux distros

uname is a GNU coreutils

uname in much more portable between MacOS
and differents GNU/Linux distros

uname is a GNU coreutils
@pin
Copy link
Owner

pin commented Oct 15, 2023

Apology for slow response!

Say, the hostname is test.example.org, then:

hostname -d would return example.org, but
uname -n would return test.

So it would not work as direct replacement, unfortunately.

Please feel free to re-open if I'm missing something!!

@pin pin closed this Oct 15, 2023
@t-h2o
Copy link
Contributor Author

t-h2o commented Oct 15, 2023

No problem for slow response, thank you for your feedbacks !

A comparison between commands

$ docker run -it --hostname my.very.long.domain.name debian:11 sh
# hostname -d
very.long.domain.name
# hostname
my.very.long.domain.name
# uname -n
my.very.long.domain.name

No, uname -n do not just return my but all the hostname.

hostname -d remove the first ^\w\+., in this case my.

I do not understand why we should remove the first part of the domain name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants