一、特点
1.安全
2.无盘符
3.一切皆文件。
4.命令操作
二、常用命令
序号 | 命令 | 举例 | 作用 |
1 | ls [目录名] | ls ./ | 查看当前目录下的内容 |
2 | pwd | print work directory | 查看当前所在目录 |
3 | cd [目录名] | change directory | 切换目录 |
4 | touch [文件名] | touch | 如果文件不存在,创建文件 |
5 | mkdir [目录名] | make directory | 创建目录 |
6 | rm [文件名] | remove | 删除指定文件 |
7 | cat [-n] fileName | cat /etc/profile | 查看/etc目录下的profile文件内容 |
8 | more fileName | more /etc/profile | 以分页的形式显示文件内容 |
9 | tail [-f] fileName | tail -f /itcast/my.log | 动态读取/itcast目录下的my.log文件末尾内容并显示 |
10 | rmdir [-p] dirName | rmdir -p itcast/test rmdir itcast* rmdir itcast | 删除itcast目录中名为test的子目录,若test目录删除后itcast目录变为空目录,则也被删除 |
11 | rm [-rf] name | rm -rf itcast/ | 无需确认,直接删除名为itcast的目录和目录中所有文件 |
12 | cp [-r] source dest -r: 如果复制的是目录需要使用此选项,此时将复制该目录下所有的子目录和文件 | cp hello.txt itcast/ cp hello.txt ./hi.txt cp -r itcast/ ./itheima/ cp -r itcast/* ./itheima/ | 将hello.txt复制到itcast目录中 将hello.txt复制到当前目录,并改名为hi.txt 将itcast目录和目录下所有文件复制到itheima目录下 将itcast目录下所有文件复制到itheima目录下 |
13 | mv source dest | mv hello.txt hi.txt mv hi.txt itheima/ | 将hello.txt改名为hi.txt 将文件hi.txt移动到itheima目录中 |
14 | tar [-zcxvf] fileName [files] | tar -zcvf hello.tar.gz ./* tar -zxvf hello.tar.gz -C /usr/local | 将当前目录下所有文件打包并压缩,打包后的文件名为hello.tar.gz 将hello.tar.gz文件进行解压,并将解压后的文件放在/usr/local目录 |
15 | vim fileName | vim fileName.txt | 文本编辑器 |
16 | find dirName -option fileName | find /itcast -name "*.java" | 在/itcast目录及其子目录下查找.java结尾的文件 |
17 | grep word fileName | grep Hello HelloWorld.java grep hello *.java | 查找HelloWorld.java文件中出现的Hello字符串的位置 查找当前目录中所有.java结尾的文件中包含hello字符串的位置 |