Linux中找不到ifconfig命令的解决方法
yum search ifconfig
通过yum search 这个命令我们发现ifconfig这个命令是在net-tools.x86_64这个包里,接下来只要安装这个包就行了
yum install net-tools.x86_64
1、man
系统参考手册的入口
SYNOPSIS
man [man options] [[section] page ...] ...
man -k [apropos options] regexp ...
man -K [man options] [section] term ...
man -f [whatis options] page ...
man -l [man options] file ...
man -w|-W [man options] page ...
man
是系统的参考手册。给man的每个page
参数通常是一个程序、实用程序或函数的名称。然后找到并显示与每个参数相关联的手册页。一个章节,如果提供,将指导人们只看手册的这一部分。默认操作是按照预定义的顺序(请参阅DEFAULTS)在所有可用的部分中搜索,并且只显示找到的第一个页面,即使页面存在于几个部分中。
下表显示了手册的section(章节)编号,以及其中包含的页面类型。
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions, e.g. /etc/passwd
# 文件格式和规范
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
# 系统管理命令(通常只针对 root 用户)
9 Kernel routines [Non standard]
0p: POSIX headers
1p: POSIX utilities
3p: POSIX functions
P 就是 POSIX 的意思。
手册页由几个部分组成。
常规的部分名称包括名称,简介,配置,描述,选项,退出状态,返回值,错误,环境,文件,版本,符合,注释,错误,例子,作者,并参见。(NAME
, SYNOPSIS
, CONFIGURATION
, DESCRIPTION
, OPTIONS
, EXIT STATUS
, RETURN VALUE
, ERRORS
, ENVIRONMENT
, FILES
, VERSIONS
, CONFORMING TO
, NOTES
, BUGS
, EXAMPLE
, AUTHOR
S, and SEE ALSO
)
以下约定适用于简介部分,也可作为其他部分的指南。
bold text type exactly as shown.
italic text replace with appropriate argument.
# 用适当的参数替换。
[-abc] any or all arguments within [ ] are optional.
# []中的任何或所有参数都是可选的。
-a|-b options delimited by | cannot be used together.
# 以|分隔的选项不能同时使用。
argument ... argument is repeatable.
# 参数是可重复的。
[expression] ... entire expression within [ ] is repeatable.
# []中的整个表达式都是可重复的。
根据输出设备的不同,准确的呈现可能有所不同。例如,man 通常不能呈现斜体时,运行在终端,并将通常使用下划线或彩色文本代替。
命令或函数说明是一种模式 (pattern),它应该匹配所有可能的调用。在某些情况下,如本手册的简介(SYNOPSIS
)部分所示,最好说明几个独占调用。
EXAMPLES
man ls
Display the manual page for the item (program) ls.
显示项(程序)ls的手册页。
man man.7
Display the manual page for macro package man from section 7. (This is an alternative spelling of "man 7 man".)
显示第7节中的宏包手册页。(这是“man 7 man”的另一种拼写。)
man 'man(7)'
Display the manual page for macro package man from section 7. (This is another alternative spelling of "man 7 man". It may be more convenient when copying and pasting cross-references to manual pages. Note that the parentheses must normally be quoted to protect them from the shell.)
显示第7节中的宏包手册页。(这是“man 7 man”的另一种拼写方式。
在复制和粘贴对手册页的交叉引用时可能会更方便。
注意,括号通常必须加引号以保护它们不受shell的影响。)
man -a intro
Display, in succession, all of the available intro manual pages contained within the manual. It is possible to quit between successive displays or skip any of them.
依次显示手册中包含的所有可用的介绍手册页。
可以在连续的显示之间退出或跳过其中任何一个。
man -t bash | lpr -Pps
Format the manual page for bash into the default troff or groff format and pipe it to the printer named ps. The default output for groff is usually PostScript. man --help should advise as to which processor is bound to the -t option.
将bash的手册页格式化为默认troff或groff格式,
并将其输送到名为ps的打印机。groff的默认输出
通常是PostScript。Man --help 应该告知哪个处理器
绑定到-t选项。
man -l -Tdvi ./foo.1x.gz > ./foo.1x.dvi
This command will decompress and format the nroff source manual page ./foo.1x.gz into a device independent (dvi) file. The redirection is necessary as the -T flag causes output to be directed to stdout with no pager. The output could be viewed with a program such as xdvi or further processed into PostScript using a program such as dvips.
此命令将解压nroff源手册页。/foo.1x.gz并将其格式化为
一个设备独立(dvi)文件。重定向是必要的,因为-T标志会
导致输出被定向到标准输出,而没有分页器。可以使用xdvi
等程序查看输出,也可以使用dvips等程序将输出进一步处
理为PostScript。
man -k printf
Search the short descriptions and manual page names for the keyword printf as regular expression. Print out any matches. Equivalent to apropos printf.
在简短描述和手册页名中搜索关键字printf作为正则表达
式。打印出所有匹配项。等价于printf。
man -f smail
Lookup the manual pages referenced by smail and print out the short descriptions of any found. Equivalent to whatis smail.
查找smail引用的手册页,并打印出任何找到的简短描述。
相当于什么是smail。
whatis
显示单行手册页描述
SYNOPSIS
whatis [-dlv?V] [-r|-w] [-s list] [-m system[,...]] [-M path] [-L locale] [-C file] name ...
apropos
搜索手册页的名称和描述
SYNOPSIS
apropos [-dalv?V] [-e|-w|-r] [-s list] [-m system[,...]] [-M path] [-L locale] [-C file] keyword ...
每个手册页都有一个简短的描述。apropos
搜索这个描述中关键字(keyword)实例。
关键字通常是一个正则表达式,就像使用了(-r
)一样,或者可能包含通配符(-w
),或者匹配精确的关键字(-e
)。使用这些选项时,可能需要引用关键字或转义(\
)特殊字符以阻止shell解释它们。
标准匹配规则允许根据描述中的页面名称和单词边界进行匹配。
通过appropos搜索的数据库由mandb程序更新。根据您的安装,可以通过定期的cron作业运行,也可以在安装了新的手册页后手动运行。
2、ifconfig
用于显示或设置网络设备。
ifconfig [网络设备][down up -allmulti -arp -promisc][add<地址>][del<地址>][<hw<网络设备类型><硬件地址>]
[io_addr<I/O地址>][irq<IRQ地址>][media<网络媒介类型>][mem_start<内存地址>][metric<数目>][mtu<字节>]
[netmask<子网掩码>][tunnel<地址>][-broadcast<地址>][-pointopoint<地址>][IP地址]
add<地址> 设置网络设备IPv6的IP地址。
del<地址> 删除网络设备IPv6的IP地址。
down 关闭指定的网络设备。
<hw<网络设备类型><硬件地址> 设置网络设备的类型与硬件地址。
io_addr<I/O地址> 设置网络设备的I/O地址。
irq<IRQ地址> 设置网络设备的IRQ。
media<网络媒介类型> 设置网络设备的媒介类型。
mem_start<内存地址> 设置网络设备在主内存所占用的起始地址。
metric<数目> 指定在计算数据包的转送次数时,所要加上的数目。
mtu<字节> 设置网络设备的MTU。
netmask<子网掩码> 设置网络设备的子网掩码。
tunnel<地址> 建立IPv4与IPv6之间的隧道通信地址。
up 启动指定的网络设备。
-broadcast<地址> 将要送往指定地址的数据包当成广播数据包来处理。
-pointopoint<地址> 与指定地址的网络设备建立直接连线,此模式具有保密功能。
-promisc 关闭或启动指定网络设备的promiscuous模式。
[IP地址] 指定网络设备的IP地址。
[网络设备] 指定网络设备的名称。
3、LINUX关机指令
LINUX关机指令
linux下常用的关机命令有:shutdown、halt、poweroff、init;重启命令有:reboot。
关机命令:
1、halt 立刻关机
2、poweroff 立刻关机
3、shutdown -h now 立刻关机(root用户使用)
4、shutdown -h 10 10分钟后自动关机 如果是通过shutdown命令设置关机的话,可以用shutdown -c命令取消重启
重启命令:
1、reboot
2、shutdown -r now 立刻重启(root用户使用)
3、shutdown -r 10 过10分钟自动重启(root用户使用)
4、shutdown -r 20:35 在时间为20:35时候重启(root用户使用) 如果是通过shutdown命令设置重启的话,可以用shutdown -c命令取消重启
shutdown
shutdown - Halt, power-off or reboot the machine
The time string may either be in the format “hh:mm” for hour/minutes specifying the time to execute the shutdown at, specified in 24h clock format.
Alternatively it may be in the syntax “+m” referring to the specified number of minutes m from now. “now” is an alias for “+0”, i.e. for triggering animmediate shutdown. If no time argument is specified, “+1” is implied.
shutdown [OPTIONS...] [TIME] [WALL...]
-H, --halt
Halt the machine.
-P, --poweroff
Power-off the machine (the default).
-r, --reboot
Reboot the machine.
-h
Equivalent to --poweroff, unless --halt is specified.
-c
Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown
with a time argument that is not "+0" or "now".
4、ulimit
ulimit
ulimit 用于限制 shell 启动进程所占用的资源,支持以下各种类型的限制:所创建的内核文件的大小、进程数据块的大小、Shell 进程创建文件的大小、内存锁住的大小、常驻内存集的大小、打开文件描述符的数量、分配堆栈的最大大小、CPU 时间、单个用户的最大线程数、Shell 进程所能使用的最大虚拟内存。同时,它支持硬资源和软资源的限制。
ulimit 命令的格式为:
ulimit [options] [limit]
5、curl
curl是一个非常实用的、用来与服务器之间传输数据的工具
curl [options] [URL...]
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP,LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP)
curl提供了一大堆非常有用的功能,包括代理访问、用户认证、ftp上传下载、HTTP POST、SSL连接、cookie支持、断点续传…。
-d, --data <data>
(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and
presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F, --form
-d @file -d “string” –data “string” –data-ascii “string” –data-binary “string” –data-urlencode “string” 【参考】 | (HTTP)使用HTTP POST方式发送“key/value对”数据,相当于浏览器表单属性(method=“POST”,enctype=“application/x-www-form-urlencoded”) -d,–data:HTTP方式POST数据; –data-ascii:HTTP方式POST ascii数据; –data-binary:HTTP方式POST二进制数据; –data-urlencode:HTTP方式POST数据(进行urlencode); 如果数据以“@”开头,后紧跟一个文件,将post文件内的内容; |
6、cat 命令
cat(英文全拼:concatenate)命令用于连接文件并打印到标准输出设备上。
cat [-AbeEnstTuv] [--help] [--version] fileName
参数说明:
-n 或 --number:由 1 开始对所有输出的行数编号。
-b 或 --number-nonblank:和 -n 相似,只不过对于空白行不编号。
-s 或 --squeeze-blank:当遇到有连续两行以上的空白行,就代换为一行的空白行。
-v 或 --show-nonprinting:使用 ^ 和 M- 符号,除了 LFD 和 TAB 之外。
-E 或 --show-ends : 在每行结束处显示 $。
-T 或 --show-tabs: 将 TAB 字符显示为 ^I。
-A, --show-all:等价于 -vET。
-e:等价于"-vE"选项;
-t:等价于"-vT"选项;
7、tar
tar是tape archive的简称。
-C, --directory=DIR
-C < 目录>:
Change to DIR before performing any operations. This option is order-sensitive, i.e. it affects all options that follow.
这个选项用在解压缩,若要在特定目录解压缩,可以使用这个选项。
-x或--extract或--get
:从备份文件中还原文件;
-v或--verbose
:显示指令执行过程;
-z或--gzip或--ungzip
:通过gzip指令处理备份文件;
-f< 备份文件>或--file=< 备份文件>
:指定备份文件;
.tar.gz,或者.tgz的文件一般是在UNIX下用tar和gzip压缩的文件。
tar -xvzf kafka_2.11-0.10.0.0.tgz -C /export/servers/
gunzip是一种比pkzip压缩比高的压缩程序,tar是一个多文件目录打包器
7.1 解压tar.xz文件
xz是一个基于LZMA算法的文件压缩算法,使用xz算法压缩的文件通常以.tar.xz
或.txz
结尾。
tar -xf archive.tar.xz
tar命令自动检测压缩文件类型并解压归档文件,该命令同样能够解压用其他压缩算法(比如.tar.gz或.tar.bz2)产生的归档文件。
7.1.1 从tar.xz中抽取指定目录
tar -xf archive.tar.xz dir001 dir002
7.1.2 从tar.xz中抽取指定文件
并列写多个压缩文件即可,文件间需要以空格分隔开
tar -xf archive.tar.xz file1 file2
需要注意的是,当从压缩文件中抽取指定文件时,必须指定精确的文件名,包括路径,正如使用tar命令时加上–list(-t)命令选项一样。
8、scp
scp — secure copy (remote file copy program)
scp copies files between hosts on a network.
人们可以使用 scp 命令在网络主机之间安全地复制文件。它使用 ssh 进行数据传输和身份验证。典型的语法是:
scp local_file remote_username@remote_ip:remote_folder
或者
scp local_file remote_username@remote_ip:remote_file #使用新的文件名
# 递归复制整个目录。注意,scp follow 树遍历中遇到的符号链接。
scp -r localpath user@remote:/remotepath
9、rz sz
文件上传下载
sz:将选定的文件发送(send)到本地机器
rz:运行该命令会弹出一个文件选择窗口,从本地选择文件上传到服务器(receive)
rz,sz是便是Linux/Unix同Windows进行ZModem文件传输的命令行工具,windows端需要支持ZModem的telnet/ssh客户端(比如SecureCRT)。注意:该方法的传输速度比较慢,推荐使用中小文件的传输。
10、ps
report a snapshot of the current processes
报告当前进程的快照
ps -ef | grep tomcat
-e Select all processes. Identical to -A 选择所有进程
-f 完全格式化的清单。这个选项可以与许多其他unix样式的选项结合使用,以添加额外的列。会打印的命令参数
11、kill
kill命令向指定的进程或进程组发送指定的信号。如果没有指定信号,则发送TERM信号。若仍无法终止该程序,可使用 SIGKILL(9) 信息尝试强制删除程序。程序或工作的编号可利用 ps 指令或 jobs 指令查看。
kill [-s <信息名称或编号>][程序] 或 kill [-l <信息编号>]
1、杀死进程
kill 12345
2、彻底杀死进程
kill -9 123456
3、显示信号
# kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
-n
12、ip
显示/操作路由,设备,策略路由和隧道
ifconfig 命令类似,但比 ifconfig 命令更加强大,主要功能是用于显示或设置网络设备
#显示分配给所有网络接口的地址
ip a 或ip addr
13、Systemd
Systemd 入门教程:命令篇
13、umask详解
umask详解
在linux系统中,我们创建一个新的文件或者目录的时候,这些新的文件或目录都会有默认的访问权限。
若用户创建一个文件,则文件的默认访问权限为 -rw-rw-rw- ,创建目录的默认权限 drwxrwxrwx ,而umask值则表明了需要从默认权限中去掉哪些权限来成为最终的默认权限值。
可以使用命令 umask 来查看umask值
hadoop@sench-pc:~$ umask
0002
14、which
shows the full path of (shell) commands.
显示(shell)命令的完整路径。
which [options] [--] programname [...]
15、ln
make links between files
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)
在第一个格式中,创建一个到TARGET
的链接(link
),名称为LINK_NAME
。
在第二种格式中,在当前目录中创建到TARGET的链接。
在第三和第四种格式中,在 DIRECTORY
中创建到每个TARGET
的链接。默认情况下创建硬链接,使用--symbolic
创建符号链接。缺省情况下,每个目的地(新链接的名称)不应该已经存在
。创建硬链接时,每个TARGET
必须存在。符号链接可以保存任意文本;如果稍后解析,则相对链接将根据其父目录进行解释。
16、find
在目录层次结构中搜索文件
-name pattern
基于文件名(删除了前导的目录路径)匹配shell模式pattern
。因为前导目录被删除了,用于与-name
匹配的文件名将永远不会包含斜杠,因此 -name a/b
将永远不会匹配任何东西(您可能需要使用-path
代替)。
17. strings
打印文件中可打印字符的字符串形式。