http://blog.chinaunix.net/uid-23105261-id-109513.html

灵活使用getconf命令来获取系统信息

我们时常需要查询系统相关的信息,比如页面大小,整数大小之类,如果编写程序去计算会比较繁琐,这里有一个很有用的命令,可以用来获取系统相关信息。它就是getconf。

 
$ getconf PAGE_SIZE
4096
$ getconf INT_MAX
2147483647
 
可以取得的相关信息如下(参考相关资料,在又在版本上会有些不同):
_CS_PATH Value for the PATH environment variable used to find commands.
ARG_MAX Maximum length, in bytes, of the arguments for one of the exec subroutines, including environment data.
BC_BASE_MAX Maximum value allowed for the obase variable with the bc command.
BC_DIM_MAX Maximum number of elements permitted in an array by the bc command.
BC_SCALE_MAX Maximum value allowed for the scale variable with the bc command.
BC_STRING_MAX Maximum length of a string constant accepted by the bc command.
CHARCLASS_NAME_MAX Maximum number of bytes in a character class name.
CHAR_BIT Number of bits in a type character.
CHAR_MAX Maximum value of a type character.
CHAR_MIN Minimum value of a type character.
CHILD_MAX Maximum number of simultaneous processes for each real user ID.
CLK_TCK Number of clock ticks per second returned by the time subroutine.
COLL_WEIGHTS_MAX Maximum number of weights that can be assigned to an entry in the LC_COLLATE locale stanza in a locale-definition file.
CS_PATH Value of the PATH environment variable used to find commands.
EXPR_NEST_MAX Maximum number of expressions that can be nested within parentheses by the expr command.
INT_MAX Maximum value of a type int.
INT_MIN Minimum value of a type int.
LINE_MAX Maximum length, in bytes, of a command's input line (either standard input or another file) when the utility is described as processing text files. The length includes room for the trailing new-line character.
LONG_BIT Number of bits in a type long int.
LONG_MAX Maximum value of a type long int.
LONG_MIN Minimum value of a type long int.
MB_LEN_MAX Maximum number of bytes in a character for any supported locale.
NGROUPS_MAX Maximum number of simultaneous supplementary group IDs for each process.
NL_ARGMAX Maximum value of digit in calls to the printf and scanf subroutines.
NL_LANGMAX Maximum number of bytes in a LANG name.
NL_MSGMAX Maximum message number.
NL_NMAX Maximum number of bytes in an N-to-1 collation mapping.
NL_SETMAX Maximum set number.
NL_TEXTMAX Maximum number of bytes in a message string.
NZERO Default process priority.
OPEN_MAX Maximum number of files that one process can have open at one time.
PATH Sequence of colon-separated path prefixes used to find commands.
RE_DUP_MAX Maximum number of repeated occurrences of a regular expression permitted when using the interval-notation parameters, such as the m and n parameters with the ed command.
SCHAR_MAX Maximum value of a type signed char.
SCHAR_MIN Minimum value of a type signed char.
SHRT_MAX Maximum value of a type short.
SHRT_MIN Minimum value of a type short.
SSIZE_MAX Maximum value of an object of type ssize_t.
STREAM_MAX Number of streams that one process can have open at one time.
TMP_MAX Minimum number of unique path names generated by the tmpnam subroutine. Maximum number of times an application can reliably call the tmpnam subroutine.
TZNAME_MAX Maximum number of bytes supported for the name of a time zone (not the length of the TZ environment variable).
UCHAR_MAX Maximum value of a type unsigned char.
UINT_MAX Maximum value of a type unsigned int.
ULONG_MAX Maximum value of a type unsigned long int.
USHRT_MAX Maximum value of a type unsigned short int.
WORD_BIT Number of bits in a word or type int

灵活使用getconf命令来获取系统信息的更多相关文章

  1. linux学习笔记:第三单元 Linux命令及获取帮助

    第三单元 Linux命令及获取帮助 11) 了解Linux命令的语法格式:命令 [选项] [参数]2) 掌握命令格式中命令.选项.参数的具体含义a) 命令:告诉Linux(UNIX)操作系统做(执行) ...

  2. Linux命令----uname查看系统信息

    uname就是UNIXname的缩写 1.uname可以查询操作系统信息 [root@yuan ~]# uname Linux 2.uname -n显示系统的主机名 [root@yuan ~]# un ...

  3. 十二、jdk工具之jcmd介绍(堆转储、堆分析、获取系统信息、查看堆外内存)

    目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...

  4. Linux基础-1.Linux命令及获取帮助

    1.Linux命令的格式 1)了解Linux命令的语法格式: 命令 [选项] [参数] 2)掌握命令格式中命令.选项.参数的具体的含义 a)命令:告诉Linux(UNIX)操作系统做(执行)什么 b) ...

  5. java 获取系统信息及CPU的使用率(转)

    java 获取系统信息及CPU的使用率 原文:http://kakaluyi.javaeye.com/blog/211492 最近做个项目,就是要取得cpu占有率等等的系统信息,一开始以为要用动态链接 ...

  6. psutil——获取系统信息的Python第三方模块

    本文摘自廖雪峰大神个人网站:https://www.liaoxuefeng.com/wiki/1016959663602400/1183565811281984 用Python来编写脚本简化日常的运维 ...

  7. C语言使用cmd命令并获取输出方法

    转自http://blog.csdn.net/hxh129/article/details/8000205 C语言使用cmd命令并获取输出方法 在实践中,我们有时候需要用C语言来调用cmd的命令,并得 ...

  8. getconf 命令

    getconf 命令 用途 将系统配置变量值写入标准输出. 系统的默认参数,比如mkfs读取默认参数,并格式化,默认PAGESIZE是4096 语法 getconf [ -v specificatio ...

  9. php获取系统信息的方法

    php获取系统信息的方法. 用 getenv函数进行处理: <?php $root = getenv('DOCUMENT_ROOT'); ////服务器文档根目录 $port = getenv( ...

随机推荐

  1. Jquery EasyUI修改行背景的两种方式

    1.数据加载完成不请求后台的做法 方式一: //更改表格行背景 function changeLineStyle(index){ var rows=$("#alertGird"). ...

  2. UESTC_Infected Land 2015 UESTC Training for Search Algorithm & String<Problem G>

    G - Infected Land Time Limit: 6000/3000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others ...

  3. Best Time to Buy and Sell Stock II 解答

    Question Say you have an array for which the ith element is the price of a given stock on day i. Des ...

  4. 将Oracle JDBC驱动库安装到本地仓库

    1.为了添加详细版本信息,先查看当前Oracle数据库版本 select * from v$version; 查询返回如下信息 BANNER ----------------------------- ...

  5. 获取某月第一天,最后一天的sql server脚本

    本文来自:http://blog.csdn.net/chaoowang/article/details/9167969 这是计算一个月第一天的SQL 脚本:   SELECT DATEADD(mm, ...

  6. linux内核中驱动开发常见的相似多态

    #include<stdio.h> #include<stdlib.h> struct test { char name[20]; void (*func)(char *); ...

  7. cocos2d-x(quick-lua)读取csv文件

    一.准备一份csv文件 ID,Name,Des,Model ID,名字,描写叙述,图片模型 1,广告,www.benmutou.com,csv.png 2,否认,呵呵,广告什么的,我才不会加,good ...

  8. github教程--廖雪峰的官方网站

    http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

  9. Spring 入门 Ioc-Xml

    通过一个小例子演视怎么通过 Spring 往程序中注入对象,而非手动 new 对象. 一.导入 Spring 所需要的包 spring-framework-2.5.6 版需要导入以下包: 1.---- ...

  10. LAMP介绍及安装

    LAMP介绍及安装 1. LAMP是什么? LAMP,包含Linux + Apache + PHP + Mysql. LAMP适用环境 适用于追求极致稳定的WEB环境,缺点是需要消耗更多资源. 除了L ...