标签:dmesg lte day har name blocks lse zabbix gcc
[root@#quan#Better ~]$uname -r #显示内核发行版本号 2.6.32-696.el6.x86_64 [root@#quan#Better ~]$uname -n #显示主机名 Better [root@#quan#Better ~]$uname -v #显示内核版本 #1 SMP Tue Mar 21 19:29:05 UTC 2017 [root@#quan#Better ~]$uname -m #显示计算机架构 x86_64 [root@#quan#Better ~]$
[root@#quan#Better ~]$hostname Better [root@#quan#Better ~]$hostname AAA #临时修改主机名 [root@#quan#Better ~]$vim /etc/sysconfig/network #永久修改主机名 [root@#quan#Better ~]$cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=Better NTPSERVERARGS=iburst [root@#quan#Better ~]$ [root@#quan#Better ~]$cat /etc/hosts #配置主机hosts解析 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@#quan#Better ~]$hostname -I #获取系统IP地址,多少个网卡就多少个IP地址 192.168.139.128 192.168.31.66 [root@#quan#Better ~]$
dmesg 用于显示内核环形缓冲区的内容,在系统引导市,内核会将硬件和模块初始化相关信息写到这个缓冲区中,/var/log/dmesg [root@#quan#Better ~]$dmesg |less Initializing cgroup subsys cpuset Initializing cgroup subsys cpu Linux version 2.6.32-696.el6.x86_64 (mockbuild@c1bm.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 21 19:29:05 UTC 2017 Command line: ro root=UUID=bedc9145
stat:详细显示文件或者文件系统的状态信息 [root@#quan#Better ~]$stat /etc/hosts File: `/etc/hosts‘ Size: 158 Blocks: 8 IO Block: 4096 regular file Device: 805h/2053d Inode: 1179681 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-09-14 23:04:36.745216799 +0800 Modify: 2010-01-12 21:28:22.000000000 +0800 Change: 2019-07-27 19:00:34.411999909 +0800 #获取文件对应的权限对应的数字内容 [root@#quan#Better ~]$stat -c %a /etc/hosts 644
du统计磁盘空间使用情况,可以查找那个文件过多使用磁盘空间 [root@#quan#Better tmp]$du -a #显示所有文件的大小,包括隐藏文件和目录下所有子文件 280 ./zabbix_server.log 0 ./.esd-0/socket 4 ./.esd-0 4 ./sess_tvr0so89lsjuv3hkpsskira1g3 0 ./pulse-DQ6pTKVyMQbA/native 4 ./pulse-DQ6pTKVyMQbA 0 ./keyring-95urfx/socket.pkcs11 0 ./keyring-95urfx/socket 0 ./keyring-95urfx/socket.ssh 4 ./keyring-95urfx 0 ./keyring-AGHgFM/socket.pkcs11 0 ./keyring-AGHgFM/socket [root@#quan#Better tmp]$du -s 显示文件总大小 392 . [root@#quan#Better tmp]$du -h 人性化显示 4.0K ./.esd-0 4.0K ./pulse-DQ6pTKVyMQbA 4.0K ./keyring-95urfx 4.0K ./keyring-AGHgFM 4.0K ./.ICE-unix 4.0K ./keyring-z210kg 4.0K ./keyring-Qhfnnd 4.0K ./keyring-vU6ECi 24K ./gconfd-gdm 8.0K ./orbit-gdm 4.0K ./keyring-hRsO0e 8.0K ./pulse-dLTEGSQL3ge3 4.0K ./keyring-SYAqed 4.0K ./keyring-wlVYuR 4.0K ./keyring-Foz4Hv 4.0K ./.X11-unix 392K . [root@#quan#Better tmp]$du -sh 392K .
[root@#quan#Better tmp]$date +%y 19 [root@#quan#Better tmp]$date +%Y 2019 [root@#quan#Better tmp]$date +%m 09 [root@#quan#Better tmp]$date +%d 15 [root@#quan#Better tmp]$date +%H 16 [root@#quan#Better tmp]$date +%M 41 [root@#quan#Better tmp]$date +%S 25 [root@#quan#Better tmp]$date +%F 2019-09-15 [root@#quan#Better tmp]$date +%T 16:41:37 [root@#quan#Better tmp]$date +%F -d "-1day" 2019-09-14 [root@#quan#Better tmp]$date +%F -d "-2day" 2019-09-13 [root@#quan#Better tmp]$date +%F -d "-1month" 2019-08-15 [root@#quan#Better tmp]$date -d "Thu May 6 21:41:16 CST 2019" "+%Y-%m-%d %H-%M-%S" 2019-05-06 21-41-16
[root@#quan#Better tmp]$which hostname #显示命令的全路径,通过PATH环境变量的路径 /bin/hostname [root@#quan#Better tmp]$which -a hostname #-a 一班是查找到就停止,不过现在遍历PATH 路径查找 /bin/hostname
[root@#quan#Better tmp]$whereis which which: /usr/bin/which /usr/share/man/man1/which.1.gz #查看文件的可执行文件和源码文件及man帮助文件的路径
locate 快速定位文件的路径 linux系统里面有一个mlocate.db的数据库文件,里面包含文件系统的文件名对应的路径星系,所有不要遍历磁盘,而是直接找数据库文件, 注意:如果是新加的文件,mlocate.db是没有记录的,所有要使用updatedb命令跟新数据库文件。 [root@#quan#Better tmp]$ll -h /var/lib/mlocate/mlocate.db -rw-r----- 1 root slocate 3.8M Sep 15 03:06 /var/lib/mlocate/mlocate.db [root@#quan#Better tmp]$cat /etc/cron.daily/mlocate.cron #!/bin/sh nodevs=$(< /proc/filesystems awk ‘$1 == "nodev" && $2 != "zfs" { print $2 }‘) renice +19 -p $$ >/dev/null 2>&1 ionice -c2 -n7 -p $$ >/dev/null 2>&1 /usr/bin/updatedb -f "$nodevs" [root@#quan#Better tmp]$
标签:dmesg lte day har name blocks lse zabbix gcc
原文地址:https://www.cnblogs.com/betterquan/p/11880126.html