列出Linux源码下所有Makefile的方法
一、要求:
1、能够显示出Makefile的总数
2、能显示一级目录下的Makefile总数、Makefile列表及其Makefile的内容
3、能将上述内容写入相应的文件
二、实例
rm -rf ~/Desktop/linux_Makefile/*
for i in `find . -maxdepth 1 -type d`
#仅仅是当前目录,所以请将本脚本放在linux源码目录下执行。
do
echo $i
mkdir -p ~/Desktop/linux_Makefile/$i
find $i -type f -name "Makefile" -print | echo -e ""$i" Total is:`wc -l`" >> ~/Desktop/linux_Makefile/total_Makefile_list_about.txt
#
Makefile的总数
find $i -type f -name "Makefile" -print | echo -e "\n"$i"'s Makefile Total number is:`wc -l`\n" > ~/Desktop/linux_Makefile/$i/"$i"_Makefile_list.txt
find $i -type f -name "Makefile" -print >> ~/Desktop/linux_Makefile/$i/"$i"_Makefile_list.txt
find $i -type f -name "Makefile" -printf "\n# ============================================================\n# " -print -printf "# ============================================================\n\n" -exec cat {} \; >> ~/Desktop/linux_Makefile/$i/"$i"_Makefile_content.txt
done
mv ~/Desktop/linux_Makefile/._Makefile_content.txt ~/Desktop/linux_Makefile/total_Makefile_content.txt
mv ~/Desktop/linux_Makefile/._Makefile_list.txt ~/Desktop/linux_Makefile/total_Makefile_list.txt
三、扩展成通用的文件归纳程序
相关文档:
如何在linux下查看当前登录的用户,并且踢掉你认为应该踢掉的用户?
看了网络中的一些例子.在这里总结一下.主要用到的命令有,w,who,ps,kill,pkill
查看当前登录用户:
node8:/home # who
root :0 2009-11-04 16:26
root pts/0 &n ......
Linux的一个吸引人的特性就是用户可以自行定制整个系统,你可是运行一个只有1M的“迷你”Linux,也可以运行一个几G的强大Linux。而无论你运行怎样的Linux,你都是先从引导程序开始运行的。对于普通用户,大多都是在个人电脑上运行Linux的。
个人电脑,又叫PC机,是我们常见的使用Intel或AMD的芯片的电 ......
转来的,没事可以看看
bin = BINaries
/dev = DEVices
/etc = ETCetera
/lib = LIBrary
/proc = PROCesses
/sbin = Superuser BINaries
/tmp = TeMPorary
/usr = Unix Shared Resources
/var = VARiable ?
FIFO = First In, First Out
GRUB = GRand Unified Bootloader
IFS = Internal Field Seperators
LILO ......
五:kmem_cache_create()分析
我们以一个例子来跟踪分析一下slab的机制:
下面是一个测试模块的代码:
#include <linux/config.h>
#include <linux/module.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ericxiao <xgr178@163.com>");
MODULE_DESCRI ......
七:kmem_cache_free()的实现
kmem_cache_free用于把从slab中分配的对象释放掉,同分配一样,它首先会把它放到AC中,如果AC满了,则把对象释放到share链中,如果share也满了,也就把它释放至slab。来看具体的代码:
void kmem_cache_free (kmem_cache_t *cachep, void *objp)
{
unsi ......