归档文章: Linux

Unix domain sockets介绍

linux/unix中当我们查看netstat -ln(监听的端口时)会发现,列出的信息分为2个部分。
一个是Active internet connections (only servers) 这个一般大家都知道,一个网络服务必然是要监听固定的端口来让客户端来访问和连接的。
一个是Active Unix domain sockets(only servers) 那这种类型的socket又代表什么呢?
A Unix domain socket or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing within the same host operating system. While similar in functionality to named pipes, Unix domain sockets may be created as byte streams or as datagram sequences, while pipes are byte streams only. Processes using Unix domain sockets do not need to share a common ancestry. The programmer’s application interface (API) for Unix domain sockets is similar to that of an Internet socket, but does not use an underlying network protocol for communication. The Unix domain socket facility is a standard component of POSIX operating systems.Unix domain sockets use the file system as address name space. They are referenced by processes as inodes in the file system. This allows two processes to open the same socket in order to communicate. However, communication occurs entirely within the operating system kernel.In addition to sending data, processes may send file descriptors across a Unix domain socket connection using the sendmsg() and recvmsg() system calls.

linux察看可用内存信息及buffer和cache的区别

如何察看linux的内存信息(可用内存和使用内存等信息)

if you add buffers and cache together, you get: 6072. If you subtract 6072 from used you get 3752 used and if you add it to free you get 8259 free. 更多…

linux(unix)文件格式类型以及dos和unix文件格式的转换

首先我们来看下linux下是如何识别文件格式的。unix,dos,mac都分别有自己使用的换行符。
The line terminator expected for each file format is:
unix LF only (each line ends with an LF character).
dos CRLF (each line ends with two characters, CR then LF).
mac CR only (each line ends with a CR character).
CR is carriage return (return cursor to left margin), which is Ctrl-M or ^M or hex 0D.
LF is linefeed (move cursor down), which is Ctrl-J or ^J or hex 0A. Sometimes, LF is written as NL (newline).

在linux shell里做个试验。 (注意^M符号通过ctrl+v 然后输入 ctrl+M)
更多…

如何build linux kernel外部的模块

make外部的模块一般是在没有移植入内核的驱动或版权属于自己的(开发中的驱动模块)

更多…

用isolinux启动引导程序制作引导cd

制作可引导的CD(也可以认为是先制作一个iso文件,再刻录)。这里我用isolinux引导程序。首先你需要下载syslinux 包或者源码包。安装完毕,在你的安装目录下,你会找到如下的一个文件isolinux.bin 这就是我们要用的引导程序了。

除了需要这个文件以外还需要一个isolinux.cfg 配置文件,他是一个菜单,将提示你进行下一步的操作等。
更多…

制作linux的usb启动盘

I will assume your USB device is at /dev/sdb
Please backup all your data in your USB key. Because all the data will be deleted.
1) Insert your USB key to your computer which run Linux OS.
Umount the USB partition if linux automatically mounts your USB partition.
2) If your USB device is /dev/sdb, Run the following command to format your USB as one FAT parition
mkdosfs -I /dev/sdbMount the one FAT parition / USB to your Linux OS
3) Copy all the contents under /cdrom/isolinux to your USB partition. eg:
cp -r /cdrom/isolinux/* /dev/sdb/In your USB partition, rename isolinux.cfg to syslinux.cfg. eg:
mv isolinux.cfg syslinux.cfg
4) Umount your USB partition. eg:
umount /dev/sdbRun the following command to make the USB bootable. eg:
syslinux /dev/sdb
Note: syslinux in some distrabuted linux version will do the all steps to make a bootable usb disk. (so under these linux os, we just run syslinux /dev/sdb) Bad point is that ,u can’t modify the boot messages and boot lables that u want urself.

nfs4协议察看以及配置

nfs server 配置允许的网络协议。 nfs4 必须需要tcp 协议

default to nfs2, nfs3, nfs4, both network protocol udp/tcp are supported by them.
see more details by “man rpc.nfsd”

simplely, first , find below line in this file “/etc/init.d/nfs”: 更多…

linux里面mount windows的共享文件夹

1. Add a share directory in windows. Since the simple file sharing in windows is recomended ,here using the simple file sharing.
2. Open “my computer”, in menu “Tools->folder option->view(tag)”, in advanced settings , check the box “simple file sharing”.
3. Then share a directory , just simplely right click the dir and choose the “sharing and security” and shared it.
4. In linux , type these to mount. As of the simple file sharing , so we just specify a user without password will access the shared dir from windows.
mount -t cifs -o root=haoli //ip/share /mnt
5. If you want more security on this share folder, you musn’t use the simple file sharing. If don’t use the simple file sharing , in linux should specify the correct user and password to mount.

date命令进行纪元秒与时间的转换

Use the date command in linux to transform from utc second to date.

Display the utc second since 1970-01-01 00:00:00 UTC.

To now.
#date +%s (lower case)
1253515801
更多…

linux 里如何telnet一个要求ssl的pop3 邮箱

如果要telnet 一个pop3邮箱需要ssl的话,用telnet的话,是不能正常通讯的。
从google上搜索到了一个很好用的工具。
因为gmail需要ssl的,(例如你在设置outlook,foxmail的时候需要将ssl的那个选项悬赏)
如下: 更多…