Skip to Content
Linux クックブック、第 2 版
book

Linux クックブック、第 2 版

by Carla Schroder
May 2025
Intermediate to advanced
544 pages
7h 23m
Japanese
O'Reilly Media, Inc.
Content preview from Linux クックブック、第 2 版

第3章 Linuxを起動する Linuxを起動、停止、再起動、スリープモードにする

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

この章では、Linux システムを停止、起動、再起動するいくつかの方法と、スリープモードを管理する方法を学ぶ。レガシーコマンドと新しい systemd コマンドの両方を学ぶ。

自動シャットダウンは、作業の停止を思い出させてくれるし、夜間のコンピュータのシャットダウンを忘れてしまうこともない。リモートマシンの自動ウェイクアップと自動シャットダウンをセットアップしておけば、作業時間中ずっと起動したままでもアクセスできる。ユーザがコンピュータの電源を切らないようなワット浪費者であれば、業務時間外にシャットダウンするように設定できる。

「Ctrl-Alt-Delete」の「3つのキーの敬礼」は、スタートアップを中断してリブートしたり、プロセスやアプリケーションが誤動作しているときにリブートしたりする必要があるときに便利だ。グラフィカルデスクトップでは、キーをより便利なキーの組み合わせにリマップできる。

シャットダウンhaltpoweroffrebootなど、数十年にわたって蓄積されてきたレガシーなシャットダウンコマンドがあり、重複する機能も多い。shutdownコマンドは、ログインしているすべてのユーザに警告を発しながら、時間指定でシャットダウンするという便利なオプションを提供する。これらのコマンドは、スクリプトやSSHセッション、そしてコマンドラインから作業しているときにいつでも役に立つ。

ルート権限は必ずしも必要ではない

昔は、シャットダウンコマンドを実行するには、root権限が必要だった。これは変わりつつあり、最近の多くのLinuxディストリビューションでは、これらのコマンドにroot権限は必要ない。この章の例は、通常の非特権ユーザーを対象としている。 もし、あなたのLinuxがroot権限を必要とする場合は、そのLinuxが教えてくれるだろう。

これらのパーミッションは、最近のLinuxディストリビューションではPolkit(旧PolicyKit)によって制御されている。詳しくはman 8 polkitを参照のこと。

しかし、 それだけではない。systemd(第4章)を搭載したLinux分散システムでは、古典的な古いコマンドはシステムにインストールされないからだ。その代わり、それらの名前はsystemctlコマンドにシンボリックリンクされている。shutdownの例のように、statコマンドでこれを見ることができる:

$ stat /sbin/shutdown
  File: /sbin/shutdown -> /bin/systemctl
  Size: 14              Blocks: 0          IO Block: 4096   symbolic link
Device: 802h/2050d      Inode: 1177556     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: ( 0/ root)   Gid: ( 0/ root)

File: 行は、/bin/systemctlへのシンボリックリンクを表示する。sbin/shutdown/sbin/halt/sbin/poweroff/sbin/rebootのレガシーコマンド名はすべて/bin/systemctlにシンボリックリンクされている。レガシーコマンド名のシンボリックリンクは、後方互換性のために提供されている。systemdのないLinuxシステムでは、これらのシンボリックリンクは存在せず、レガシーの実行可能ファイルが使われる。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Jake VanderPlas, 菊池 彰
Arduino Cookbook、第 3 版

Arduino Cookbook、第 3 版

Michael Margolis, Brian Jepson, Nicholas Robert Weldin
Bash クックブック第2版

Bash クックブック第2版

Carl Albing, JP Vossen

Publisher Resources

ISBN: 9798341650091