Linux基础-2

1、版本宏函数

#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
eg:printf("===%x\n",KERNEL_VERSION(2,6,11));

2、demsg:检测和控制内核环缓冲;显示所有信息

1、dmesg:dmesg --help查看用法
2、用root权限执行 cat /proc/kmsg,查看内核的调试信息
kmsg里面就是显示内核消息的,程序中printk的输出都可以看到,

3、开机信息

开机信息亦保存在/var/log目录中;执行:cat /var/log查看

4、查看系统信息

[ubuntu:root]$ hostnamectl
   Static hostname: ubuntu-virtual-machine
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a310e68e764ffe92628ad74
           Boot ID: e03c392db5e22d892d148f0
    Virtualization: vmware
  Operating System: Ubuntu 16.04.4 LTS
            Kernel: Linux 4.13.0-36-generic
      Architecture: x86-64

5、查看是哪个发行版

[ubuntu:root]$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	    16.04
Codename:	    xenial

6、查看内核版本和gcc信息

[ubuntu:root]$ cat /proc/version
Linux version 4.13.0-36-generic (buildd@lgw01-amd64-033) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)) #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018

7、查看内核版本

[ubuntu:root]$ uname -a
Linux ubuntu-virtual-machine 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

8、如果是REDHAT的系统,还可以查看

[root@root]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

9、多层目录下的文件格式需要转换,dos2unix 没有-r之类的递归指令,所以需要与find还有管道结合。
find -type f | xargs dos2unix -o 

发布了78 篇原创文章 · 获赞 9 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/heguangsui123/article/details/102746333