目录文件的基本操作命令察看目录建立/删除/改变目录显示文件内容查找文件或目录安装/卸载文件系统文件/目录的权限修改
目录文件的基本操作命令 ⚫察看目录 ⚫建立/删除/改变目录 ⚫显示文件内容 ⚫查找文件或目录 ⚫安装/卸载文件系统 ⚫文件/目录的权限修改
察看目录IsIs-l以长格式显示文件ls-a显示所有文件,包括隐含文件Is-d显示目录的内容[vbird@tsai /]$ ls -ltotal 153drwxr-xr-x2 root4096Feb1002:06binroot3 rootdrwxr-xr-xroot4096Feb922:05mntdrwx-4 rootroot4096Feb1615:25rootdrwxr-xr-x16 rootroot4096Feb 10 01:28 usr1 rootroot14226Feb1001:28hello-rwx--x--x1 rootroot34342Feb 10 01:28readme-rw-r--r-
察看目录 ls ⚫ ls -l 以长格式显示文件 ⚫ ls -a 显示所有文件,包括隐含文件 ⚫ ls -d 显示目录的内容 [vbird@tsai /]$ ls -l total 153 drwxr-xr-x 2 root root 4096 Feb 10 02:06 bin drwxr-xr-x 3 root root 4096 Feb 9 22:05 mnt drwx- 4 root root 4096 Feb 16 15:25 root drwxr-xr-x 16 root root 4096 Feb 10 01:28 usr -rwx-x-x 1 root root 14226 Feb 10 01:28 hello -rw-r-r- 1 root root 34342 Feb 10 01:28 readme
显示文件内容cat[vbird@tsai/]$catfile1显示file1的内容1111111111111111111111111[vbird@tsai】]$catfile2显示file2的内容2222222222222222222222222[vbird@tsai/]$catfile1file2>file3把file1和file2合并到file3中显示file3的内容[vbird@tsai/]$catfile311111111111111111111111112222222222222222222222222显示file3的内容[vbird@tsai/]$head-1file31111111111111111111111111[vbird@tsai/]$ tail-1file3显示file3的内容2222222222222222222222222
显示文件内容 -- cat [vbird@tsai /]$ cat file1 显示file1的内容 1111111111111111111111111 [vbird@tsai /]$ cat file2 显示file2的内容 2222222222222222222222222 [vbird@tsai /]$ cat file1 file2 >file3 把file1和file2合并到file3中 [vbird@tsai /]$ cat file3 显示file3的内容 1111111111111111111111111 2222222222222222222222222 [vbird@tsai /]$ head -1 file3 显示file3的内容 1111111111111111111111111 [vbird@tsai /]$ tail -1 file3 显示file3的内容 2222222222222222222222222
显示文件内容—- head / tailheadnfilename:显示文件前面的n行tail+n[/-n]filename:从文件开头[结尾]第n行开始显示文件的内容#head3 test文件test:this is line 1this is line 1this is line 2this is line 2this is line 3this is line 3this is line 4this is line 5# tail -4 testthis is line 6this is line 5this is line 7this is line 6this is line 8this is line 7this is line 8
显示文件内容 -- head / tail ⚫ head n filename:显示文件前面的n行 ⚫ tail +n[/-n] filename:从文件开头[结尾]第n行开始显示文件的内容 # head 3 test this is line 1 this is line 2 this is line 3 # tail -4 test this is line 5 this is line 6 this is line 7 this is line 8 文件test: this is line 1 this is line 2 this is line 3 this is line 4 this is line 5 this is line 6 this is line 7 this is line 8
显示文件内容一一 more /less分页显示文件都可以前后翻页less具有更多的功能,例如搜索等# less filename# more filename
显示文件内容 -- more / less ⚫分页显示文件 ⚫都可以前后翻页 ⚫less具有更多的功能,例如搜索等 # less filename # more filename