歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> centos7命令總結

centos7命令總結

日期:2017/3/6 9:48:09   编辑:學習Linux

centos7命令總結


centos7命令總結


1,查看cpu信息

lscpu

2,網絡配置

ip route 查看路由

nmcli

nmcli connection show 顯示所有連接

nmcli connection show -a 僅顯示當前活動的連接

nmcli device status 列出 NetworkManager 識別出的設備列表及他們的狀態

nmcli device disconnect eno16777736 停止接口

nmcli device connect eno16777736 啟動接口

nmtui 類似centos6中的 setup

配置主機名

/etc/hostname

hostnamectl

hostname

3,系統語言設置

區域設置的配置文件在/etc/locale.conf,通過localectl命令進行設置;

localectl status 查看當前配置

localectl list-locales |grep CN 查看可用的區域語言

localectl set-locale LANG=zh_CN.utf8 設置區域語言

4,配置時間和日期

timedatactl date

timedatectl 等同於timedatectl status

timedatectl set-time YYYY-MM-DD 設置日期

timedatectl set-time HH:MM:SS 設置當前時間

timedatectl set-local-rtc boolean 默認的,系統是使用UTC時間的,可以用以下命令打開和關閉UTC時間

把 boolean 替換成yes則表示使用本地時間,替換成no則表示是UTC時間

注:這裡的boolean值也可以用true、flase

timedatectl list-timezones 查看所有的時區

timedatectl set-timezone time_zone 用以下命令設置時區

設置時區也可以直接復制系統文件 :

timedatectl set-ntp boolean timedatectl還可以設置是否打開NTP選項 (這裡的boolean是yes或者no)

# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

5,時鐘同步配置

/etc/chrony.conf

timedatectl

ntpdate

6,strace ltrace

7,系統服務

systemctl -at service

ls /etc/systemd/system/*.service

ls /usr/lib/systemd/system/*.service

查看活動的服務

systemctl -t service --state=active

啟動/停止 服務

systemctl start name.service

systemctl stop name.service

設置開機是否啟動服務

systemctl enable name.service

systemctl disable name.service

查看服務器狀態

systemctl status name.service

檢查服務是否enabled

systemctl is-enabled name

創建新的服務

systemctl daemon-reload /etc/systemd/system/*.service

8,運行級別

查看

who -r

runlevel

修改

切換到:運行級3

systemctl isolate multi-user.target 或 systemctl isolate runlevel3.target

切換到:運行級5

systemctl isolate graphical.target 或 systemctl isolate runleve5.target

修改開機默認運行級別

systemd使用鏈接來指向默認的運行級別,由/etc/systemd/system/default.target文件中決定

切換到運行級3:

先刪除:/etc/systemd/system/default.target

ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target

systemctl set-default multi-user.target

9,日志

/var/log

journalctl

10,配置grub

/etc/default/grub

grub-set-default

grub2-mkconfig

11,查看硬件信息

lshw (in EPEL)

yum install epel-release -y

yum install lshw -y

12,加載、配置內核模塊

modprobe

刪除內核模塊

modprobe -r

查看內核參數

sysctl -a

cat /proc/cmdline

http://xxxxxx/Linuxjc/1134216.html TechArticle

Copyright © Linux教程網 All Rights Reserved