
目录
常用 man 创建指定大小文件——用来做一些I/O测试 程序计时 FHS (Filesystem Hierarchy Standard) 常用 man创建指定大小文件——用来做一些I/O测试用户在shell环境中可以 *** 作的命令或可执行文件
系统内核可调用的函数与工具等 一些常用的函数(function)与函数库(library),大部分为C的函数库(libc) 设备文件的说明,通常是在/dev下的文件 配置文件或者是某些文件的格式 游戏(games) 惯例与协议等,例如linux文件系统、网络协议、ASCII code等说明 系统管理员可用的管理命令跟kernel有关的文件
truncate -s xxM test.file
shrink or extend the size of a file to the specifIEd size
-c --no-create
-o --io-blocks
-s --size
……please man
fallocate -l 25000000 test.file
preaallocate or deallocate space to a file
-l --length bytes
……please man
dd if=/dev/urandom of=test.file bs=25MB count=1
dd if=/dev/zero of=test.file bs=25MB count=1
convert and copy a file
bs=BYTES
if=file _read from file instead of stdin
of=file -write to file instead of stdout
head -c 25MB /dev/urandom > test.file
head -c 25MB /dev/zero > test.file
程序计时-c --bytes
-n --lines
命令 time ./xx.out
#include <sys/time.h>struct timeval t1,t2;gettimeofday(&t1,NulL);do();gettimeofday(&t2,NulL);cout << (t2.tv_sec - t1.tv_sec) * 1000000 + t2.tv_usec - t1.tv_usec; // microsecond
<time.h>clock(); clock_gettime(); // man 去FHS (filesystem HIErarchy Standard)
文件系统层次标准,其实仅仅规定了
/ :与开机、还原、修复、内核……所在分区越小越好,错误机会更少 /usr :UNIX software resource 软件安装、执行相关 /var :系统运作有关
| shareable(可分享给其他系统使用的) | unshareable(自身及其有关的) | |
|---|---|---|
| static(不常随分发版改动的,函数库、说明文件……) | /usr (软件) | /etc(配置文件) |
| /opt (第三方软件) | /boot (开机、内核) | |
| variable | /var/mail | /var/run |
| /var/spool/news | /var/lock |
/ 的建议包含(不是全都建议一个分区里嗷)
| dir | content |
|---|---|
| /bin | binary,单用户模式还能用,一般情况root、普通用户可用cat,chmod,date…… |
| /boot | 内核、开机相关,vmlinuz(kernel文件) |
| /opt | 第三方软件,有些也习惯在/usr/local |
| /etc | 各种配置文件,一般root可改,普通可看 |
| /sbin | system binary,开机修复还原常用的,一般root可用 |
| /dev | 一些特殊设备/dev/zero,/dev/urandom,/dev/null** |
| /home | |
| /lib | 开机、bin、sbin会用的一些函数库,/lib/modules驱动相关 |
| /media | 光盘、软盘…… |
| /mnt | 暂时挂载设备 |
| /root | 通常需要与/在一个分区,因为单用户模式需要挂上 |
| /srv | 网络服务相关 |
| /tmp |
其他重要的
| dir | content |
|---|---|
| /lost+found | ext2/3发送错误时,一些丢失片段丢这里 |
| /proc | 一个virtual filesystem,不占磁盘,仅在内存,主要是一些内核,进程,外部设备和网络状态 |
| /sys | 也是virtual filesystem,主要是内核已加载模块和检测到的设备信息 |
以上是内存溢出为你收集整理的Linux常用知识全部内容,希望文章能够帮你解决Linux常用知识所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)