Linux工具-wc
参考文献
wc
1wc -clwm file
-c: 打印字节数
-l: 打印行数
-w: 打印单词总数
-m: 打印字符总数
常用示例
统计当前文件下的文件个数,目录个数
123456789# 统计当前目录下的文件数量(不包含子目录中的文件)ls -l|grep "^-"|wc -l# 统计当前目录下的文件数量(包含子目录中的文件)ls -lR|grep "^-"|wc -l# 统计当前目录下的目录数量(不包含子目录中的)ls -l|grep "^d"|wc -l# 统计当前目录下的目录数量(包含子目录中的)ls -lR|grep "^d"|wc -l
Linux病毒扫描工具-ClamAV
参考文献
ClamAV Documentation
Linux 杀毒软件 ClamAV 初体验
ClamAV
ClamAV是一个开源(GPLv2)反病毒工具包,专为在邮件网关上扫描电子邮件而设计。它提供了许多实用程序,包括一个灵活的、可扩展的多线程守护进程、一个命令行扫描程序和用于自动数据库更新的高级工具。该软件包的核心是以共享库的形式提供的防病毒引擎。
安装
使用软件包安装
默认的从源代码安装将进入 /usr/local ,其中包含:
应用程序:/usr/local/bin
守护进程:/usr/local/sbin
库文件:/usr/local/lib
头文件:/usr/local/include
配置文件:/usr/local/etc/
病毒库:/usr/local/share/clamav/
使用Linux软件包安装,默认安装在 /usr 中,其中包含:
应用程序:/usr/bin
守护进程:/usr/sbin
库文件:/usr/lib
头文件:/usr/include
配置文件:/etc/clamav
病毒库:/var/lib/clamav/
配置C ...
Linux工具-scp
参考文献
scp
1scp [参数] [原路径] [目标路径]
命令参数
-1 强制scp命令使用协议ssh1
-2 强制scp命令使用协议ssh2
-4 强制scp命令只使用IPv4寻址
-6 强制scp命令只使用IPv6寻址
-B 使用批处理模式(传输过程中不询问传输口令或短语)
-C 允许压缩。(将-C标志传递给ssh,从而打开压缩功能)
-p 留原文件的修改时间,访问时间和访问权限。
-q 不显示传输进度条。
-r 递归复制整个目录。
-v 详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。
-c cipher 以cipher将数据传输进行加密,这个选项将直接传递给ssh。
-F ssh_config 指定一个替代的ssh配置文件,此参数直接传递给ssh。
-i identity_file 从指定文件中读取传输时使用的密钥文件,此参数直接传递给ssh。
-l limit 限定用户所能使用的带宽,以Kbit/s为单位。
-o ssh_option 如果习惯于使用ssh_config(5)中的参数传递方式,
-P port 注 ...
Linux工具-tcpdump
参考文献
https://wizardzines.com/zines/tcpdump/
https://www.tcpdump.org/manpages/tcpdump.1.html
https://www.tcpdump.org/manpages/pcap-filter.7.html
tcpdump
tcpdump抓包使用的是libpacp这种机制.它的大致原理是:在收发包时,如果该包符合tcpdump设置的规则(BPF filter),那么该网络包就会被拷贝一份到tcpdump的内核缓冲区,然后以PACKET_MMAP的方式将这部分内存映射到tcpdump用户空间,解析后就会把这些内容给输出了
123456789101112root@root:/home/root# tcpdump -htcpdump version 4.9.3libpcap version 1.9.1 (with TPACKET_V3)OpenSSL 1.1.1f 31 Mar 2020Usage: tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ ...
Linux工具-wget
参考文献
wget
1wget [参数] [URL地址]
命令参数
启动参数:
-V, –version 显示wget的版本后退出
-h, –help 打印语法帮助
-b, –background 启动后转入后台执行
-e, –execute=COMMAND 执行’.wgetrc’格式的命令,wgetrc格式参见/etc/wgetrc或~/.wgetrc
记录和输入文件参数
-o, –output-file=FILE 把记录写到FILE文件中
-a, –append-output=FILE 把记录追加到FILE文件中
-d, –debug 打印调试输出
-q, –quiet 安静模式(没有输出)
-v, –verbose 冗长模式(这是缺省设置)
-nv, –non-verbose 关掉冗长模式,但不是安静模式
-i, –input-file=FILE 下载在FILE文件中出现的URLs
-F, –force-html 把输入文件当作HTML格式文件对待
-B, –base=URL 将URL作为在-F -i参数指定的文件中出现的相对链接的前缀
–sslcertfile=FIL ...
Linux工具-top
参考文献
top linux下的任务管理器
top命令说明
1234567891011top - 16:30:42 up 308 days, 19:08, 1 user, load average: 0.00, 0.02, 0.00Tasks: 120 total, 1 running, 119 sleeping, 0 stopped, 0 zombie%Cpu(s): 0.5 us, 1.0 sy, 0.0 ni, 98.2 id, 0.0 wa, 0.3 hi, 0.0 si, 0.0 stMiB Mem : 3591.0 total, 158.4 free, 2741.9 used, 690.7 buff/cacheMiB Swap: 0.0 total, 0.0 free, 0.0 used. 565.8 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ...
Linux-ssh
参考文献
如何愉快地将 linux 作为开发环境: ssh 隧道
如何配置SSH别名
SSH
12345678910ssh [options] [user@]host [command]usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port ...
Linux工具-cURL
参考文献
https://www.bilibili.com/video/BV1n94y1U7Eu/?spm_id_from=333.788
https://www.ruanyifeng.com/blog/2019/09/curl-reference.html
https://catonmat.net/cookbooks/curl
cURL
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162# 基础用法curl URL# POSTcurl -X -POST URLcurl -XPOST URLcurl -XPOST URL -d '{}'# --data-urlencode参数等同于-d,发送 POST 请求的数据体,区别在于会自动将发送的数据进行 URL 编码。curl --data-urlencode 'comment=hello world' ...
Linux工具-VIM
参考文献
精通 VIM ,此文就够了
多模式文本编辑器
四种模式
正常模式(Normal-mode) 默认
正常模式一般用于浏览文件,也包括一些复制、粘贴、删除等操作.这时击键时,一些组合键就是 vim 的功能键,而不会在文本中键入对应的字符.
在这个模式下,我们可以通过键盘在文本中快速移动光标,光标范围从小到大是字符、单词、行、句子、段落和屏幕.启动 VIM 后默认位于正常模式.不论是什么模式,按一下 <Esc> 键 ( 有时可能需要按两下,插入模式按一下 Esc ,就会切换到正常模式,命令模式或者可视模式下执行完操作以后,就会自动进入正常模式,如果进入命令模式或者可视模式没有执行任何操作,按两下 Esc 即可 )都会进入正常模式.
插入模式(Insert-mode)
该模式下可以输入内容
按下i,l,o,O,a,A,R等任何一个字母之后才会进入插入模式
命令模式(Command-mode)
在正常模式中,按下:(冒号)键或者/ (斜杠),会进入命令模式.在命令模式中可以执行一些输入并执行一些 VIM 或插件提供的指令,就像在shell里一样.这些指令 ...
yum配置
yum源描述
yum需要一个yum库,也就是yum源。默认情况下,CentOS就有一个yum源。在/etc/yum.repos.d/目录下有一些默认的配置文件(可以将这些文件移到/opt下,或者直接在yum.repos.d/下重命名)。
首先要找一个yum库(源),然后确保本地有一个客户端(yum这个命令就是客户端),由yum程序去连接服务器。连接的方式是由配置文件决定的。通过编辑/etc/yum.repos.d/CentOS-Base.repo文件,可以修改设置。
yum配置源
首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo
1mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
进入yum源配置文件所在文件夹
1cd /etc/yum.repos.d
配置网易源
CentOS 7
1wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
CentOS ...