写给自己

一、常用命令

1.who

我是谁?谁在登录主机,他们分别是谁,IP地址多少

  1. [root@gaox ~]# who
  2. # 用户名 终端 登录时间和地址
  3. root tty1 2018-12-02 16:06
  4. root pts/0 2018-12-02 16:27 (112.226.1.75)

网络命令

axel多线程下载: axel -n 10 https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz

wget URL 网络下载

查看系统位数

01 uname -a

  1. uname -a

Linux gaox 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

02 file /bin/ls

  1. file /bin/ls

/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=3d705971a4c4544545cb78fd890d27bf792af6d4, stripped

03 /proc/version

  1. cat /proc/version

Linux version 3.10.0-693.2.2.el7.x86_**64** (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017

64标志是64位操作系统

04 long类型长度

32位的系统中int类型和long类型一般都是4字节,
64位的系统中int类型还是4字节的,但是long已变成了8字节

Linux系统中可用”getconf WORD_BIT”和”getconf LONG_BIT”获得word和long的位数。64位系统中应该分别得到32和64。

  1. getconf WORD_BIT

32

  1. getconf LONG_BIT

64

查看系统版本

01 lsb

  1. lsb_release -a

LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.4.1708 (Core) Release: 7.4.1708 Codename: Core

02 os-release

  1. cat /etc/os-release

NAME=”CentOS Linux” VERSION=”7 (Core)” ID=”centos”

ID_LIKE=”rhel fedora”

VERSION_ID=”7”

PRETTY_NAME=”CentOS Linux 7 (Core)”

ANSI_COLOR=”0;31”

CPE_NAME=”cpe:/o:centos:centos:7”

HOME_URL=”https://www.centos.org/

BUG_REPORT_URL=”https://bugs.centos.org/

CENTOS_MANTISBT_PROJECT=”CentOS-7”

CENTOS_MANTISBT_PROJECT_VERSION=”7”

REDHAT_SUPPORT_PRODUCT=”centos”

REDHAT_SUPPORT_PRODUCT_VERSION=”7”

03 redhat-release

  1. cat /etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

结果等同与**/etc/centos-release**

04 centos-release

  1. rpm -q centos-release

centos-release-7-4.1708.el7.centos.x86_64

查看内核版本

01 uname -r

  1. uname -r

3.10.0-693.2.2.el7.x86_64

02 /proc/version

  1. cat /proc/version

Linux version 3.10.0-693.2.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017