Linux常用命令总结 linux命令的分类 命令详解 1. 文件处理命令 ls(list) 2. 文件处理命令 cd(change directory) 3. 文件处理命令 pwd(print working directory) 4. 文件处理命令 touch(touch) 5.文件处理命令 mkdir(make directory) 6.文件处理命令 cp(copy) 7.文件处理命令 mv(move) 8.文件处理命令 rm(remove) 9.文件处理命令 cat(concatenate and display files) 10.文件处理命令 more 11.文件处理命令 head 12.文件处理命令 tail 13.文件处理命令 wc 14.文件处理命令 ln(link) 15.文件搜索命令 find 16.文件搜索命令 grep 17.压缩解压命令 gzip(GUN zip) 18.压缩解压命令 gunzip(GUN unzip) 19.压缩解压命令 tar 20.压缩解压命令 z

Linux常用命令总结
linux命令的分类
命令详解
1. 文件处理命令 ls(list)
2. 文件处理命令 cd(change directory)
3. 文件处理命令 pwd(print working directory)
4. 文件处理命令 touch(touch)
5.文件处理命令 mkdir(make directory)
6.文件处理命令 cp(copy)
7.文件处理命令 mv(move)
8.文件处理命令 rm(remove)
9.文件处理命令 cat(concatenate and display files)
10.文件处理命令 more
11.文件处理命令 head
12.文件处理命令 tail
13.文件处理命令 wc
14.文件处理命令 ln(link)
15.文件搜索命令 find
16.文件搜索命令 grep
17.压缩解压命令 gzip(GUN zip)
18.压缩解压命令 gunzip(GUN unzip)
19.压缩解压命令 tar
20.压缩解压命令 zip
21.压缩解压命令 unzip
22.压缩解压命令 bzip2
23.压缩解压命令 bunzip2
24.权限管理命令 chmod(change the permissions mode of a file)
25.帮助命令 man(manual)
26.帮助命令 info(information)
25.帮助命令 whatis(search the whatis database for strings)

内部命令:属于Shell解析器的一部分

  例如:cd 切换目录(change directory)

  pwd 显示当前工作目录(print working directory)

  help 帮助

外部命令:独立于Shell解析器之外的文件程序

例如:ls 显示文件和目录列表(list)

  mkdir 创建目录(make directoriy)

  cp 复制文件或目录(copy)

命令详解

1. 文件处理命令 ls(list)

功能描述:显示文件目录

语法: ls 选项[-ald][文件或目录]

  -a 显示所有文件,包括隐藏文件

  -l 详细信息显示

  -d 查看目录属性

2. 文件处理命令 cd(change directory)

功能描述:切换目录

范例: $ cd / 切换到根目录

$ cd .. 回到上一级目录

3. 文件处理命令 pwd(print working directory)

功能描述:显示当前所在的工作目录

范例: $ pwd

4. 文件处理命令 touch(touch)

功能描述:创建空文件

范例: $ touch newfile

5.文件处理命令 mkdir(make directory)

功能描述:创建新目录

范例: $ mkdir newdir

6.文件处理命令 cp(copy)

功能描述:复制文件或目录

语法: cp -R [源文件或目录][目的目录]

-R 复制目录

7.文件处理命令 mv(move)

功能描述:移动文件/更名

语法: mv [源文件或目录][目的目录]

范例: $ mv file1 file3

将当前目录下文件file1更名为file3

$ mv file2 dir2

将文件file2 移动到目录dir2下

8.文件处理命令 rm(remove)

功能描述:删除文件

语法: rm -r [文件或目录]

-r 删除目录

范例:$ rm file3

删除文件file3

$ rm -r dir1

删除目录dir1

9.文件处理命令 cat(concatenate and display files)

功能描述:显示文件内容

语法: cat[文件名]

范例:$ cat /etc/issue

$ cat /etc/services

10.文件处理命令 more

功能描述:分页显示文件内容

语法: more[文件名]

(空格)或f 显示下一页

(Enter)显示下一行

Q或q退出

范例:$ more /etc/issue

11.文件处理命令 head

功能描述: 查看文件的前几行

语法: head -num[文件名]

-num 显示文件的前num行

范例:$ head -20 /etc/issue

12.文件处理命令 tail

功能描述:查看文件的后几行

语法: tail -num[文件名]

-num 显示文件的后num行

-f 动态显示文件内容

范例:$ tail -30 /etc/issue

13.文件处理命令 wc

功能描述:统计文本的行数、字数、字符数

语法: cat -mwl [文件名]

-m 统计文本字符数

-w 统计文本字数

-l 统计文本行数

14.文件处理命令 ln(link)

功能描述:产生链接文件

语法: ln -s [源文件] [目标文件]

-s 创建软链接

范例:$ ln -s /etc/issue /issue.soft

创建文件/etc/issue的软连接/issue.soft

$ln /etc/issue /issue.hard

创建文件/etc/issue的硬连接/issue.hard

15.文件搜索命令 find

功能描述:查找文件或目录

语法:find [搜索路径] [搜寻关键字]

范例:$ find /etc -name init

在目录/etc中查找文件init

$find / -size +204800

在根目录下查找大于100MB的文件

$find / -user sam

在根目录下查找所有者为sam的文件

$find /etc -ctime -1

在/etc查找24小时内被修改过属性的文件和目录

$find /etc -size +163840 -a -size -204800

在/etc查找大于80MB小于100MB的文件

$find /etc -name init -exec ls -l { } ;

在/etc下查找init文件并显示其详细信息

16.文件搜索命令 grep

功能描述:在文件中搜寻字符串匹配的行并输出

语法:grep [指定字串] [源文件]

范例:$grep ftp /etc/service

-v参数是过滤

17.压缩解压命令 gzip(GUN zip)

功能描述:压缩文件

语法:gzip 选项[文件]

压缩后文件格式: .gz

18.压缩解压命令 gunzip(GUN unzip)

功能描述:解压缩 .gz 的压缩文件

语法:gunzip 选项 [压缩文件]

范例: $ gunzip file1.gz

19.压缩解压命令 tar

功能描述:打包目录

语法:tar 选项[cvf] [目录]

-c 产生.tar打包文件

-v 显示详细信息

-f 指定压缩后的文件名

-z 打包同时压缩

解压缩语法

-x 解压.tar文件

-v 显示详细信息

-f 指定解压文件

-z 解压缩

压缩后文件格式: .tar.gz

20.压缩解压命令 zip

功能描述:压缩文件或目录

语法:zip 选项[-r] [压缩后文件名称][文件或目录]

-r 压缩目录

压缩后文件格式: .zip

21.压缩解压命令 unzip

功能描述:解压.zip的压缩文件

语法:unzip [压缩文件]

范例:$ unzip test.zip

22.压缩解压命令 bzip2

功能描述:压缩文件

语法:bzip2 选项[-k] [文件]

-k 产生压缩文件后保留原文件

压缩后文件格式: .bz2

23.压缩解压命令 bunzip2

功能描述:解压缩文件

语法:bunzip2 选项[-k] [压缩文件]

-k 解压缩文件后保留原文件

24.权限管理命令 chmod(change the permissions mode of a file)

Linux常用命令总结
linux命令的分类
命令详解
1. 文件处理命令 ls(list)
2. 文件处理命令 cd(change directory)
3. 文件处理命令 pwd(print working directory)
4. 文件处理命令 touch(touch)
5.文件处理命令 mkdir(make directory)
6.文件处理命令 cp(copy)
7.文件处理命令 mv(move)
8.文件处理命令 rm(remove)
9.文件处理命令 cat(concatenate and display files)
10.文件处理命令 more
11.文件处理命令 head
12.文件处理命令 tail
13.文件处理命令 wc
14.文件处理命令 ln(link)
15.文件搜索命令 find
16.文件搜索命令 grep
17.压缩解压命令 gzip(GUN zip)
18.压缩解压命令 gunzip(GUN unzip)
19.压缩解压命令 tar
20.压缩解压命令 zip
21.压缩解压命令 unzip
22.压缩解压命令 bzip2
23.压缩解压命令 bunzip2
24.权限管理命令 chmod(change the permissions mode of a file)
25.帮助命令 man(manual)
26.帮助命令 info(information)
25.帮助命令 whatis(search the whatis database for strings)

功能描述:改变文件或目录权限

语法:chmod [{ugo}{+-=}{rwx}][文件或目录]

[mode=421] [文件或目录]

范例:$ chmod g+w file1

赋予文件file1所属组写权限

$chmod 777 dir1

设定目录dir1 为所有用户具有全部权限

Linux常用命令总结
linux命令的分类
命令详解
1. 文件处理命令 ls(list)
2. 文件处理命令 cd(change directory)
3. 文件处理命令 pwd(print working directory)
4. 文件处理命令 touch(touch)
5.文件处理命令 mkdir(make directory)
6.文件处理命令 cp(copy)
7.文件处理命令 mv(move)
8.文件处理命令 rm(remove)
9.文件处理命令 cat(concatenate and display files)
10.文件处理命令 more
11.文件处理命令 head
12.文件处理命令 tail
13.文件处理命令 wc
14.文件处理命令 ln(link)
15.文件搜索命令 find
16.文件搜索命令 grep
17.压缩解压命令 gzip(GUN zip)
18.压缩解压命令 gunzip(GUN unzip)
19.压缩解压命令 tar
20.压缩解压命令 zip
21.压缩解压命令 unzip
22.压缩解压命令 bzip2
23.压缩解压命令 bunzip2
24.权限管理命令 chmod(change the permissions mode of a file)
25.帮助命令 man(manual)
26.帮助命令 info(information)
25.帮助命令 whatis(search the whatis database for strings)

25.帮助命令 man(manual)

功能描述:获得帮助信息

语法:man [命令或配置文件]

范例:$ man ls

26.帮助命令 info(information)

功能描述:获得帮助信息

语法:man [任何关键字]

范例:$ info ls

25.帮助命令 whatis(search the whatis database for strings)

功能描述:获得索引的简短说明信息

语法:whatis apropos[任何关键字]

范例:$ whatis ls

$ apropos fstab 相当于 man -k

### makewhatis

建立whatis和apropos搜索使用的数据库,当使用这两个命令发生错误时,就是数据库没有建立

原文转自【Java知音】公众号