- 系统版本
cat /etc/redhat-release
:查看发行版本号
cat /proc/version
或者uname -r
:查看内核版本
getconf LONG_BIT
或者uname -m
:查看系统多少位
[root@localhost home]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
- 查看系统时间
date +%Y-%m-%d
或者date +%F
:显示当前时间,以年-月-日的格式
date +%H:%M
或者date +%R
:显示当前时间和分钟,以 13:34的格式
date +%H:%M:%S
或者date +%T
:显示当前时分秒,以 13:34:12的格式
[root@localhost home]# date
Tue Mar 2 18:17:33 CST 2021
[root@localhost home]# date +%Y-%m-%d
2021-03-02
- 查看系统时区
timedatectl
:显示当前时间+时区
date +%Z
:显示当前时区
[root@localhost home]# date +%Z
CST #时区,亚洲/上海
[root@localhost home]# timedatectl
Local time: Thu 2021-03-04 15:09:28 CST #当前时间
Universal time: Thu 2021-03-04 07:09:28 UTC #格林威治时间
RTC time: Thu 2021-03-04 07:09:25
Time zone: Asia/Shanghai (CST, +0800) #时区
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
timedatectl list-timezones
:查看所有的时区
4.设置系统时间&时区
timedatectl set-timezone "Asia/Shanghai"
:设置时区
timedatectl set-time "2021-03-01 12:30:10"
或者date -s="2021-03-01 12:30:10"
:设置时间
修正bios的时间为当前系统时间:hwclock -w
5. 查看日历:cal
[root@localhost home]# cal
March 2021
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
[root@localhost home]# cal 1 2020
January 2020
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
-
系统语言相关
cat /etc/locale.conf
或者echo $LANG
、locale
: 查看系统默认语系
locale -a
:查看系统支持的语系 -
查看历史执行的命令:history
!!:执行最新的一条命令
!num:执行第num条命令 -
命令别名
alias
: 查看当前系统中所有设置了别名的命令
alias 别名='命令'
:给命令设置别名
unalias 别名
:取消命令别名
[root@localhost home]# alias vi='vim'
[root@localhost home]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias vi='vim' #刚命名的vi命令
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
- 查看命令使用
whatis
或者man -f
:查看命令的作用
命令更多使用参数通过man查看
man查看命令下:
按【空格】或者【page up】或者【page down】进行翻页
按【home】到第一页
输入【/str】:可以查找指定内容里,利用n/N进行向下或者向上查询