linux /procÎļþϵͳ±à³ÌʵÀý
proc_test.c
/*
*proc ipsec test
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/stat.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#define IPSEC_CONNTRACK "ipsec_conntrack"
MODULE_AUTHOR("Qxl");
MODULE_DESCRIPTION("Proc Test Module");
MODULE_LICENSE("GPL");
static char msg[255] = {0};
static struct proc_dir_entry * p_entry = NULL;
static ssize_t ipsec_conntrack_read(struct file * file,char *data,size_t len,loff_t *offset)
{
printk("offset %d\n",(int)*offset);
if(*offset > 0) return 0;
if(copy_to_user(data,msg,strlen(msg)) < 0)
return -1;
*offset += strlen(msg);
return strlen(msg);
}
static ssize_t ipsec_conntrack_write(struct file *file, const char *data,size_t len,loff_t *offset)
{
if(copy_from_user(msg,(void *)data,len))
return -EFAULT;
msg[len - 1] = '\0';
printk("%s\n", msg);
return len;
}
static struct file_operations ipsec_conntrack_ops =
{
read:ipsec_conntrack_read,
write:ipsec_conntrack_write,
};
static int __init proc_ipsec_init()
{
printk("module_init\n");
p_entry = create_proc_entry(IPSEC_CONNTRACK,S_IFREG | S_IRUGO ,proc_net);
&nbs
Ïà¹ØÎĵµ£º
[root@proxyo ~]#
¶øÎÒÒª½«ÖмäµÄproxyo¸Ä³Ésearch
1. vi /etc/hosts
[root@proxyo ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 ......
¿ÉÒÔ˵Õâ°ë¸öÔ°ɣ¬ÎÒ¼¸ºõÿÌì¶¼ÔÚ×°Ubuntu9.04ºÍUbuntu9.10¡£»¹ÓкìÆìLinux 7.0¡£ÆäÖÐ֨װ×î¶àµÄ¾ÍÊÇUbuntu 9.10 ¡£Ã¿´Î֨װ¶¼Óв»Í¬µÄÎÊÌâºÍ¸ÐÊÜ¡£
Ê×ÏÈ˵ºìÆì¡£ËûÊÇÖпƵijɹû£¬Ö§³ÖÖÐÎÄÄÇÊÇûµÃ˵£¬ºÜºÃÁË¡£¶øÇÒÒ»°ã²»»á³öÏÖÒòΪÓïÑÔ¶øÒýÆðµÄÎÊÌ⣨ÖÁÉÙÎÒû·¢ÏÖ£©£¬°²×°³É¹¦Ö®ºó£¬¸ÃÊÇÖÐÎĵͼÓÐÖÐÎÄÖ§³Ö¡£»¹ÓоÍÊÇ¿ÉÒ ......
ͨ¹ýcÓïÑÔ»ù´¡¿â´Ó»ñÈ¡linuxÓû§µÄ»ù±¾ÐÅÏ¢¡£
1¡¢Ê¹ÓÃstruct passwd¹ÜÀíÓû§ÐÅÏ¢¡£
struct passwd
{
char *pw_name; /* Óû§µÇ¼Ãû */
char *pw_passwd;   ......
Linux sort ÃüÁîÏê½â
2007-06-23 02:34
Óï·¨¸ñʽ
sort [ -A ] [ -b ] [ -c ] [ -d ] [ -f ] [ -i ] [ -m] [ -n ] [ -r ] [ -u ] [ -o OutFile ]
[ -t Character ] [ -T Directory ] [ -y [ Kilobytes ] ] [ -z RecordSize ] [ [ + [ FSkip ]
[ .CSkip ] [ b ] [ d ] [ f ] [ i ] [ n ] [ r ] ] [ - [ FSkip ] [ .C ......