Files
tldr/pages.ru/linux/hostnamectl.md

21 lines
746 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# hostnamectl
> Получение и установка имени хоста компьютера.
> Больше информации: <https://manned.org/hostnamectl>.
- Получить имя хоста компьютера:
`hostnamectl`
- Задать имя хоста компьютера:
`sudo hostnamectl set-hostname "{{имя_хоста}}"`
- Задать красивое (короткое) имя хоста компьютера:
`sudo hostnamectl set-hostname --static "{{имя_хоста.example.com}}" && sudo hostnamectl set-hostname --pretty "{{имя_хоста}}"`
- Сбросить имя хоста компьютера к значению по умолчанию:
`sudo hostnamectl set-hostname --pretty ""`