Several basic directory files in Linux
http://blog.51cto.com/13523981/2055286 (the more detailed here)
File system storage Presumably, this light theory is not very well understood. (You can check online)
File system probably:
Superblock (Occupied space-total)
Inode (Index information)
Block (data size)
Link
1. Hard-Link ln source file destination file (cannot operate on directory, cannot cross operating system, remove one of the other files is not affected) (hard links are more like copy and paste in Windows, but can operate on folders)
[[email protected] boke]# ls -i (显示出文件/目录的inode) 918011 1 942691 2 942692 3 931215 a 925186 a1b 931292 b 782599 c 931764 file 931388 file1 942690 no 931296 vim
2. Soft link ln-s source file destination file (can operate on the directory, can cross the system source and target using different inode, all of your action on the target file is to modify the source file, if the source file has a hard connection, then all the files will be modified, delete the soft link, does not affect the source, Delete source affects all linked files)
(soft links are more like shortcuts in Windows)
[[email protected] boke]# ll -itotal 12912130 -rw-r--r--. 2 root root 2 Apr 23 12:28 fu918011 drwxr-xr-x. 2 root root 4096 Apr 23 12:30 mulu925186 lrwxrwxrwx. 1 root root 5 Apr 23 12:47 mulu2 -> mulu/912130 -rw-r--r--. 2 root root
Find command
- Ls-r directory (recursively find all files/directories in the directory)
- Whereis (7 system, finding the specified command)
- which command (alias variable, type which view command type)
- Locate file name (not real-time, fuzzy query, Fast) (based on/var/lib/mlocate/mlocate.db database lookup, updatedb update database
[[email protected] boke]# cat /etc/cron.daily/mlocate.cron (定时任务来更新此数据库)#!/bin/shnodevs=$(< /proc/filesystems awk ‘$1 == "nodev" { print $2 }‘)renice +19 -p $$ >/dev/null 2>&1ionice -c2 -n7 -p $$ >/dev/null 2>&1/usr/bin/updatedb -f "$nodevs"
[Email protected] boke]# vim/etc/updatedb.conf
prunepaths = "/afs/media/net/sfs/tmp/udev/var/cache/ccache/var/spool/cups/var/spool/squid/var/tmp" (Update not to update these places)
-----5.find 路径 查找条件 找到后的动作(条件可以连用 默认动作:打印) 条件:name,type,size,perm... 例子:[[email protected] boke]# find /etc/ -name *.conf -exec 命令 {} 路径 \;(分两步!可以与重定向,管道...连用 先执行-exec前面的部分,然后每执行一行就写入到{}里面 \;是换行和结束符)(-exec可以替换成-ok,变成交互式)/etc/sudo.conf/etc/php-fpm.d/www.conf/etc/ld.so.conf/etc/named.conf/etc/fprintd.conf/etc/ntp.conf......----------bash简介1.history(命令缓存历史)!+ 数字 执行命令历史换成的对应指令!! 执行上一条命令!$ 上一条命令的参数ctrl + r 搜索关键字-----alias 查看当前用户所有别名alias 新名字=‘命令‘(立即生效)alias 一般写到家目录下文件的环境变量(永久生效)(执行一下文件或重启都可以)-----tab(键盘上的)(补全功能 按一下显示唯一条件,按两下是不唯一条件)-----ctrl + a(跳命令行行首)ctrl + e(跳命令行行尾)ctrl + l(清屏)ctrl + c(终端)ctrl + d(推出当前用户)-----今晚,发一篇简单的DNS+邮件服务器的搭建。
Linux basic Commands (iv)