LoginSignup
1
1

More than 5 years have passed since last update.

CentOS7の業務に役に立つ基本コマンド

Last updated at Posted at 2018-11-06

ホスト名を変更する

# vi /etc/hostname

サーバのIPアドレスを変更する

# nmtui

パッケージを追加する

基本的にyumコマンドでパッケージを追加します。

パッケージを全て最新状態にする

# yum update

時刻同期する

CentOS7.3よりntpdに代わりchronydがデフォルトで採用されています。

自動的にchronydが起動しているためにntpdを起動しても失敗します(ポートを既にchronydに取られているため)

どうしてもntpdを使いたい場合はchronydを停止、自動起動をoffにしてntpdを起動します。

chronyd同期確認

# chronyc sources
# chronyc tracking

サービスの開始、停止

例としてApacheの起動と停止

systemctl start httpd
systemctl stop httpd
systemctl status httpd

サービスの自動起動、自動起動停止

systemctl enable httpd
systemctl disable httpd

topコマンド

サーバの負荷状況を確認する

uptimeコマンド

サーバの稼働時間を調査する

ssコマンド

ポートの開放状況を確認する
Windowsでいうnetstatコマンド
CentOS6以前にも使われている

who

ユーザのログイン状況を確認する

whoamiコマンド

自分のユーザを確認する

historyコマンド

コマンドの履歴を確認する

dfコマンド

ディスクの使用量を確認

1
1
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
1
1