Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linuxº¯Êý¡¢½á¹¹ÌåÑо¿

ѧϰ±ðÈ˵ģ¬¼Ç¼×Ô¼ºµÄ¡£
1¡¢sysinfoÓ÷¨
#include <sys/sysinfo.h>
int sysinfo(struct sysinfo info);
¼Ç¼ÁËlinuxÖÐÆô¶¯Ê±¼ä¡¢ÄÚ´æÐÅÏ¢¡¢½»»»·ÖÇø¡¢cpu¸ºÔصÈÐÅÏ¢¡£
³É¹¦·µ»Ø0£¬Ê§°Ü·µ»Ø-1
struct sysinfo {
    long uptime;             /* Seconds since boot */
    unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
    unsigned long totalram;  /* Total usable main memory size */
    unsigned long freeram;   /* Available memory size */
    unsigned long sharedram; /* Amount of shared memory */
    unsigned long bufferram; /* Memory used by buffers */
    unsigned long totalswap; /* Total swap space size */
    unsigned long freeswap;  /* swap space still available */
    unsigned short procs;    /* Number of current processes */
    unsigned long totalhigh; /* Total high memory size */
    unsigned long freehigh;  /* Available high memory size */
    unsigned int mem_unit;   /* Memory unit size in bytes */
    char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding for libc5 */
};
2¡¢statfsÓ÷¨
#include <sys/vfs.h>
int statfs(const char *path, struct statfs *buf);
int fstatfs(int fd, struct statfs *buf);
struct statfs{
   long f_type; ¡¢/*ÎļþϵͳÀàÐÍ*/
   long f_bsize;   /*¾­¹ýÓÅ»¯µÄ´«Êä¿é´óС*/
   long f_blocks; /*ÎļþϵͳÊý¾Ý¿é×ÜÊý*/
   long f_bfree; /*Îļþϵͳ¿ÕÏпé*/
   long f_bavail; /*·Ç³¬¼¶Óû§¿ÉÒÔÓõĿéÊý*/
   long f_files;   /*Îļþ½Úµã×ÜÊý*/
   long f_ffree; /*¿ÕÏÐÎļþ½Úµã×ÜÊý*/
   fsid_t f_fsid; /*Îļþϵͳ±êʶ*/
   long f_namelen; /*ÎļþÃûµÄ×î´ó³¤¶È*/
};


Ïà¹ØÎĵµ£º

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

ÐÞ¸ÄLinuxÖ÷»úÃûµÄ·½·¨

°æ±¾:CentOS 5.3
Ò»¡¢hostnameÃüÁî
¹¦ÄÜ£ºÏÔʾ»òÉèÖÃϵͳÖ÷»úÃû(ÁÙʱ£¬ÖØÆô»Ö¸´)
1.hostname ÏÔʾÖ÷»úÃû
hostnameÃüÁîÏÔʾÓÉgethostname º¯Êý·µ»ØµÄϵͳÖ÷»úÃû
hostname  -d ÏÔʾdomain name
hostname  -f  ÏÔʾFQDN
hostname  -i  ÏÔʾip
 
2.hostname  host
½«Ö÷»úÃûÁÙʱÐÞ ......

linuxÏÂDNSµÄ ÅäÖÃ

Ò»£ºÍøÂç»·¾³
bind9.4
Ö÷»úÃû£¨hostname£©:centos
ip£º192.168.1.168
dns£º192.168.1.1£¨ÅäÖÃÍêºó£¬ÐèÒªÐ޸ģ¬Ö¸Ïò192.168.1.168£¬ÐÞ¸Ä/etc/resolv.conf),
Òª´ïµ½µÄÄ¿µÄ£º°ÑÕą̂Ö÷»úÅäÖóÉһ̨dns·þÎñÆ÷
dns server:ns1.test.com
ip£º192.168.1.168
www.test.com 192.168.1.168
¶þ£º°²×°¹ý³Ì
°²×°µÄĿ¼ÊÇ/usr/lo ......

¡¶wc¡· linuxÃüÁîÎå·ÖÖÓϵÁÐ֮ʮÆß

ת×Ô£ºhttp://roclinux.cn/?p=1288#more-1288
½ñÌìµÄÄÚÈÝÊÇLinuxµÄwcÃüÁÕâ¸öÃû×ֺܺüǣ¬ÒòΪʲô£¬ÄãÒ²ÖªµÀ¡£
Õâ¸öÃüÁîµÄ¹¦ÄÜÒ²ºÜºÃ¼Ç£¬ÒòΪËü¹¦ÄܺÜÓÐÏÞ£º
wc -c filename£ºÏÔʾһ¸öÎļþµÄ×Ö½ÚÊý
wc -m filename£ºÏÔʾһ¸öÎļþµÄ×Ö·ûÊý
wc -l filename£ºÏÔʾһ¸öÎļþµÄÐÐÊý
wc -L filename£ºÏÔʾһ¸öÎļþÖеÄ×î³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ