Centos基础配置

修改名称

#vim /etc/hostname

配置IP

#vim /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=static

IPADDR=10.20.2.206

NETMASK=255.255.255.0

GATEWAY=10.20.2.254

DNS1=10.20.2.200

DNS2=202.96.134.133

查看版本

cat /etc/redhat-release

CentOS Linux release 7.7.1908 (Core)

uname -a

Linux MinDocWiki 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

资源查看

free -h

total      used      free    shared    buffers    cached

Mem:          31G        30G      317M        39M        16G      4.8G

-/+ buffers/cache:      9.7G        21G

Swap:          15G      168M        15G

Linux 优先使用物理内存,当物理内存还有空闲时,linux是不会施放内存的,即时占用内存的程序已经被关闭了(这部分内存就用来做缓存了)。用 used 减去 buffer 和 cache,才是运行中的程序所占用的空间,

ps -aux | sort -k3nr | head -n 10

查看使用CPU排名前10的进程

ps -aux | sort -k4nr | head -n 10

查看使用内存排名前10的进程

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

brony    20967  0.1  0.1 349360 35952 ?        S    08:20  0:16 smbd -F

ddl      2391  4.6  0.1 352356 38936 ?        S    08:38  6:00 smbd -F


USER //用户名

%CPU      //进程占用的CPU百分比

%MEM      //占用内存的百分比

VSZ      //该进程使用的虚拟內存量(KB)  1024KB=1M

RSS      //该进程占用的固定內存量(KB)(驻留中页的数量)

STAT      //进程的状态

START    //该进程被触发启动时间

TIME      //该进程实际使用CPU运行的时间


远程拷贝

scp [email protected]:/root/1/1.txt /home/root

scp [email protected]:/root/1/ /home/root

你可能感兴趣的:(Centos基础配置)