linux文件系统及常用的管理命令
来源:互联网 发布:https协议端口 编辑:程序博客网 时间:2024/05/21 07:15
(一)rootfs(Root FileSystem)
/boot: 系统启动相关的文件。 如内核、initrd、grub(bootloader)
/dev: 设备文件
块设备文件:随机访问,数据块
字符设备文件: 线性访问,一字节为单位
每一个设备文件都有一个主设备号和一个从设备号
/etc: 配置文件
/home: 家目录
每一个用户的家目录默认为/home下与用户名同名的目录
/root:管理员家目录
/lib: 库文件
静态库 (.a)
动态库(.so shared object)
/media: 挂载点目录 主要是移动设备 如:U盘
/mnt: 挂载点目录主要是额外的临时文件系统 如:磁盘
/opt: 可选目录
/proc: 伪文件系统,内核映射文件,在系统启动前,该目录为空
/sys: 伪文件系统,与硬件设备相关的属性映射文件,在系统启动前,该目录为空
/tmp: 临时文件
/var: 可变化的文件
/bin: 可执行文件,用户命令
/sbin: 可执行文件,管理员命令
/usr: 全局共享只读文件
/usr/local: 第三方软件安装目录
(二)命名规则
1. 文件名长度不超过255个字符
2. 不能使用/做文件名
3. 严格区分大小写
(三)文件管理常用命令
touch: 修改文件的时间戳、也可用于创建空白文件(change file timestamps)
-c, --no-create:不创建文件(do not create any files)
-t STAMP:修改时间戳(use [[CC]YY]MMDDhhmm[.ss] instead of current time)
stat:显示、修改文件状态(display file or file system status)
nano: 编辑文件(Nano's ANOther editor, an enhanced free Pico clone)
vim:编辑文件(IMproved, a programmers text editor)
rm:删除文件(remove files or directories)
-f, --force:强制删除,没有提示(ignore nonexistent files and arguments, never prompt)
-r, -R, --recursive:递归删除(remove directories and their contents recursively)
-d, --dir:删除空目录(remove empty directories)
-v, --verbose:显示删除过程(explain what is being done)
cp: 复制文件和目录,默认状态只复制文件,不复制目录( copy files and directories)
-R, -r, --recursive:递归复制(copy directories recursively)
-i, --interactive: 提示是否覆盖(prompt before overwrite (overrides a previous -n option))
-f, --force: if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used)
-P, --no-dereference: 复制链接文件时,复制该文件,不是复制该文件所链接到的目标文件(never follow symbolic links in SOURCE)
-a, --archive:归档复制,常用于备份
mv: 移动文件
install:复制文件并设置文件属性(copy files and set attributes)
(四)目录管理常用命令
ls: 显示当前目录下的文件和目录(list directory contents)
cd:转到某个目录(change the working directory)
pwd: 显示当前所在的工作目录(print name of current/working directory)
mkdir: 创建目录(make directories)
-p, --parents:从父目录一级一级创建目录,直到目标目录创建完毕为止(no error if existing, make parent directories as needed)
-v, --verbose:显示详细的创建过程(print a message for each created directory)
tree:显示目录树( list contents of directories in a tree-like format.)
rmdir:删除空目录(remove empty directories)
(五)文本处理常用命令
cat:链接并显示文件,从文件开始显示(concatenate files and print on the standard output)
-n, --number: 从1开始对所有行编号并显示(number all output lines)
-e: 在行尾加注$(display $ at end of each line)
tac:按行逆序显示文件,即从最后一行向前显示(concatenate and print files in reverse)
翻页(翻屏):
shift + PgUp(空格键):上一页(上一屏)
shift + PgDn(b键):下一页(下一屏)
more :文件过滤器,分屏显示文件内容,只能向后翻页(file perusal filter for crt viewing)
less :分屏显示文件内容,随意翻页(opposite of more)
head: 查看文件开头几行的内容,默认10行(output the first part of files)
tail: 查看文件后几行的内容,默认10行(output the last part of files)
-f: 查看文件尾部,不退出,等待查看文件尾部追加的新内容,可用于监视日志文件
cut:剪切、分割每一行的内容( remove sections from each line of files)
-d, --delimiter=DELIM:指定分割符,默认为一个空格(use DELIM instead of TAB for field delimiter)
-f, --fields=LIST: 指定分割后显示的字段(select only these fields; also print any line that contains no delimiter character, unless the -s option is specified)
如:$ cut -d: -f1 passwd
sort:对文件按行排序,默认情况把所有的内容当做字符,按照ascll码排序(sort lines of text files)
-n, --numeric-sort:数值排序通常用于对数字排序(compare according to string numerical value)
-r, --reverse:逆序排序(reverse the result of comparisons)
-t, --field-separator=SEP:指定字段分隔符(use SEP instead of non-blank to blank transition)
-k, --key=KEYDEF:根据指定的字段进行排序(sort via a key; KEYDEF gives location and type)
-u, --unique:去掉排序结构中重复的行,相邻并重复的才叫重复行(with -c, check for strict ordering; without -c, output only the first of an equal run)
-f, --ignore-case: 排序时忽略大小写(fold lower case to upper case characters)
uniq: 报告或省略重复的行,相邻并完全相同的才叫重复行(report or omit repeated lines)
-d, --repeated:只显示重复的行(only print duplicate lines)
-c, --count:显示重复的次数(prefix lines by the number of occurrences)
-D, --all-repeated[=delimit-method]:显示重复的行和原来的行(print all duplicate lines delimit-method={none(default),prepend,separate} Delimiting is done with blank lines)
wc:统计文本的行、字符数、字节数(print newline, word, and byte counts for each file)
-l, --lines: 统计行数(print the newline counts)
-m, --chars:统计字符数(print the character counts)
-c, --bytes:统计字节数(print the byte counts)
tr:转换或删除字符(translate or delete characters)-L, --max-line-length:统计最长行的字符数(print the length of the longest line)
如:tr 'a-z' 'A-Z' < passwd
- linux文件系统及常用的管理命令
- linux 中磁盘及文件系统管理命令
- 文件管理操作的命令及原理——Linux磁盘管理及文件系统管理
- linux文件系统及管理
- Linux常用文件系统的制作命令
- LINUX命令及文件系统
- 常用Linux进程及作业管理命令
- 常用Linux进程及作业管理命令
- Linux入门五:磁盘及文件系统管理命令
- Linux入门六:磁盘及文件系统管理命令
- 第三章、Linux根文件系统及文件管理命令详解
- linux笔记-根文件系统及文件管理命令详解
- 第三章、Linux根文件系统及文件管理命令详解
- linux系统管理命令-文件系统管理
- Linux磁盘及文件系统管理 3---- 文件系统
- linux 文件系统及磁盘管理
- Linux的文件系统管理
- Linux的文件系统管理
- 使用IOS7原生API进行二维码条形码的扫描
- C++/MFC修行之路(8)MFC中IPADDRESS控件的使用
- python思考
- 第一次c++上机实验
- Java day02 九九乘法表
- linux文件系统及常用的管理命令
- 利用gdb分析从start_kernel到init启动的过程
- CodeBlocks,cannot open output file permission denied的解决办法
- js 中对象
- RTB竞价中的cookie mapping技术
- Java单例模式、多例模式
- C++第一次实验+1
- [LeetCode] Single Number & Single Number III
- JVM学习笔记(四)之类加载机制