sh: steve bourne
bash: bourne-again shell, gpl, centos和ubuntu 默认使用
csh: c shell,C语言风格
tcsh
ksh:korb shell,aix默认shell
zsh: macos 默认shell
bash shell
GNU Bourne-Again Shell(bash)是GNU计划中重要的工具软件之一,目前也是linux标准的shell,也sh兼容
显示使用的shell
显示当前使用的shell
[root@localhost ~]
/bin/bash
显示当前系统中所有使用的shell
[root@localhost ~]
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
设置主机名:
[root@localhost ~]
[root@localhost ~]
shell中可执行的两类命令
内部命令:由shell自带,而却通过命令形式提供,用户登录后自动加载并常驻内存中
外部命令:在文件系统路径下有对应的可执行程序文件,当执行命令行是才从磁盘加载至内存中,执行完毕后从内部中删除
区别指定的命令是内部或者是外部命令
type COMMAND
[root@localhost ~]
echo is a shell builtin
echo is /usr/bin/echo
内部命令相关
help 内部命令略表
enable 管理内部命令
enable cmd 启动内部命令
enable -n cmd禁用内部命令
enable -n 查看所有禁用的内部命令
执行外部命令
which -a | --skip-alias
whereis
hash缓存
系统hash表未空,当外部命令执行时,默认会从path路径下寻找命令,找到后会将这条命令的路径记录到hash表中,当再次使用该命令时,shell解释器首先会查看hash表,存在将执行之,如果不存在降回去PATH路径下寻找,利用hash缓存表可大大提高命令的调用速率
hash命令常见用法
hash 显示hash缓存
hash -l 显示hash缓存,可作为输入使用
hash -p path name 经命令全路径 path 起别名为name
hash -t name 打印缓存中name的路径
hash -d name 清除name缓存
hash -r 清除全部缓存
查看硬件信息
1、查看cpu
lscpu命令可以查看cpu信息
cat /proc/cpuinfo 也可以看到
[root@localhost ~]
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
Stepping: 3
CPU MHz: 2793.547
BogoMIPS: 5587.09
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
[root@localhost ~]
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
stepping : 3
microcode : 0x25
cpu MHz : 2793.547
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
bogomips : 5587.09
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
stepping : 3
microcode : 0x25
cpu MHz : 2793.547
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
bogomips : 5587.09
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
stepping : 3
microcode : 0x25
cpu MHz : 2793.547
cache size : 3072 KB
physical id : 1
siblings : 2
core id : 0
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
bogomips : 5587.09
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
stepping : 3
microcode : 0x25
cpu MHz : 2793.547
cache size : 3072 KB
physical id : 1
siblings : 2
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
bogomips : 5587.09
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
2、查看内存大小
free
car /proc/meminfo
[root@localhost ~]
total used free shared buff/cache available
Mem: 3863568 176912 3106372 11904 580284 3393768
Swap: 2097148 0 2097148
[root@localhost ~]
MemTotal: 3863568 kB
MemFree: 3106348 kB
MemAvailable: 3393764 kB
Buffers: 2108 kB
Cached: 478264 kB
SwapCached: 0 kB
Active: 342312 kB
Inactive: 206596 kB
Active(anon): 69316 kB
Inactive(anon): 11124 kB
Active(file): 272996 kB
Inactive(file): 195472 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2097148 kB
SwapFree: 2097148 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 68536 kB
Mapped: 25216 kB
Shmem: 11904 kB
Slab: 99932 kB
SReclaimable: 47132 kB
SUnreclaim: 52800 kB
KernelStack: 4368 kB
PageTables: 4548 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 4028932 kB
Committed_AS: 300204 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 201340 kB
VmallocChunk: 34359310332 kB
HardwareCorrupted: 0 kB
AnonHugePages: 10240 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 106304 kB
DirectMap2M: 4087808 kB
DirectMap1G: 2097152 kB
3、查看硬盘分区情况
[root@localhost ~]
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 26G 0 part
├─centos-root 253:0 0 20G 0 lvm /
├─centos-swap 253:1 0 2G 0 lvm [SWAP]
└─centos-home 253:2 0 4G 0 lvm /home
sr0 11:0 1 1024M 0 rom
[root@localhost ~]
-bash: car: command not found
[root@localhost ~]
major minor
8 0 31457280 sda
8 1 2048 sda1
8 2 1048576 sda2
8 3 27270144 sda3
11 0 1048575 sr0
253 0 20971520 dm-0
253 1 2097152 dm-1
253 2 4194304 dm-2
查看系统版本信息
查看内核版本
[root@localhost ~]
Linux ccq 3.10.0-862.el7.x86_64
[root@localhost ~]
3.10.0-862.el7.x86_64
查看系统发行版本
[root@localhost ~]
CentOS Linux release 7.5.1804 (Core)
[root@localhost ~]
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"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)