• linux常用的指令(centos)


    查看Linux的版本:

    1)[root@localhost ~]# cat /proc/version

    Linux version 2.6.18-194.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Fri Apr 2 14:58:14 EDT 2010

    2)

    [root@localhost ~]# uname -a

    Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

    3)

    [root@localhost ~]# uname -r

    2.6.18-194.el5

    2. 查看linux版本:

    1) 列出所有版本信息,(该方法需要在安装lsb_release的条件下)

    [root@localhost ~]# lsb_release -a

    LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch

    Distributor ID: CentOS

    Description:    CentOS release 5.5 (Final)

    Release:        5.5

    Codename:      Final

    注:这个命令适用于所有的linux,包括RedHatSUSE、Debian等发行版。

    2) 执行cat /etc/issue,例如如下:

    [root@localhost ~]# cat /etc/issue

    CentOS release 5.5 (Final)

    Kernel r on an m

    3) 执行cat /etc/redhat-release ,例如如下:(我一直用这个命令)

    [root@localhost ~]# cat /etc/redhat-release

    CentOS release 5.5 (Final)

    查看系统是64位还是32位:

    1、getconf LONG_BIT or getconf WORD_BIT

    [root@localhost ~]# getconf LONG_BIT

    64

    2、file /bin/ls

    [root@localhost ~]# file /bin/ls

    /bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

    3、lsb_release  -a

    [root@localhost ~]# lsb_release -a

    LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch

    Distributor ID: CentOS

    Description:    CentOS release 5.5 (Final)

    Release:        5.5

    Codename:      Final

    4、或者是使用查看文件的方法。

    vim /ect/issue

    查看文件夹的大小:

    du -ah --max-depth=1     这个是我想要的结果  a表示显示目录下所有的文件和文件夹(不含子目录),h表示以人类能看懂的方式,max-depth表示目录的深度。

    du命令用来查看目录或文件所占用磁盘空间的大小。常用选项组合为:du -sh

      一、du的功能:`du` reports the amount of disk space used by the specified files and for each subdirectory (of directory arguments). with no arguments,`du` reports the disk space for the current directory。
      很明显,与df不同,它用来查看文件或目录所占用的磁盘空间的大小。
      二、du常用的选项:
      -h:以人类可读的方式显示
      -a:显示目录占用的磁盘空间大小,还要显示其下目录和文件占用磁盘空间的大小
      -s:显示目录占用的磁盘空间大小,不要显示其下子目录和文件占用的磁盘空间大小
      -c:显示几个目录或文件占用的磁盘空间大小,还要统计它们的总和
      --apparent-size:显示目录或文件自身的大小
      -l :统计硬链接占用磁盘空间的大小
      -L:统计符号链接所指向的文件占用的磁盘空间大小
      一、du -h:这个就不多说了。
      二、du -a:使用此选项时,显示目录和目录下子目录和文件占用磁盘空间的大小。
  • 相关阅读:
    【Java】Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named *** in this SqlMap.
    【Mac】Mac 使用 zsh 后, mvn 命令无效
    【Java】Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099
    【Android】drawable VS mipmap
    【Android】java.lang.SecurityException: getDeviceId: Neither user 10065 nor current process has android.permission.READ_PHONE_STATE
    java sql解析
    java动态编译
    随想
    一致hash算法
    一致性哈希算法及其在分布式系统中的应用
  • 原文地址:https://www.cnblogs.com/laozhuang/p/7306667.html
Copyright © 2020-2023  润新知