0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux] クロック設定_date, hwclock, timedatectl

Posted at

dateコマンド

$ date [MMDDhhmm[[CC]YY][.ss]]
$ date [+表示形式]
オプション 由来 説明
default date/time 現在の日付と時刻を表示(デフォルト書式)
例:Mon Jun 17 13:45:00 JST 2024
MMDDhhmm[[CC]YY] manual set システム日付・時刻を手動で変更
MM=月、DD=日、hh=時、mm=分、CC=世紀(20など)、YY=年、.ss=秒
例:date 061814302025 → 2025年6月18日14時30分に変更
+表示形式 custom format 日付・時刻を指定したフォーマットで表示
例:date "+%Y/%m/%d %H:%M:%S"2025/06/18 14:30:00 のように出力される

表示形式

書式 意味
%Y 西暦(4桁) 2025
%m 月(2桁) 06
%d 日(2桁) 18
%H 時(24時間制) 14
%M 30
%S 00
%a 曜日(英語) Wednesday
%b 月名(英語) June

hwclockコマンド

# hwclock [オプション]
オプション 由来 説明
default hardware clock ハードウェアクロックの時刻を表示(基本的には -r と同じ動作)
-r read ハードウェアクロックの時刻を表示
例:hwclock -r2025-06-18 14:30:00 のような形式で出力
-s set system from hardware ハードウェアクロックの時刻をシステムクロックに反映
例:hwclock -s は RTC(BIOS時計)→ Linux時刻 へ更新
-w write hardware from system システムクロックの時刻をハードウェアクロックに書き込み
例:hwclock -w は Linux時刻 → RTC に反映

Ping-t

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?