2020-01-07

1. yum

  • yum源:Linux下载软件 软件仓库
    • 默认yum源:随机地方 修改yum源为指定的网站
    • 增加新的yum源:epel源
[root@oldboyedu ~]# ll /etc/yum.repos.d/
total 32
-rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Nov 23 2018 CentOSDebuginfo.
repo
-rw-r--r--. 1 root root 314 Nov 23 2018 CentOSfasttrack.
repo
-rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
[root@oldboyedu ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the
client and the
# update status of each mirror to pick mirrors that are
updated to and
# geographically close to the client. You should use this
for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back
you can try the
# remarked out baseurl= line instead.
#
#
#mirrorlist 下载地址
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?
release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$base
arch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?
release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/
$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?
release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$
basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing
packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?
release=$releasever&arch=$basearch&repo=centosplus&infra=$inf
ra
#baseurl=http://mirror.centos.org/centos/$releasever/centospl
us/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  • 把系统当前的yum源修改为从清华/阿里云下载
#查看Linux当前使用的yum源是什么?
[root@oldboyedu ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
base | 3.6 kB
00:00:00
extras | 2.9 kB
00:00:00
updates | 2.9 kB
00:00:00
(1/4): base/7/x86_64/group_gz | 165 kB
00:00:00
(2/4): extras/7/x86_64/primary_db | 153 kB
00:00:00
(3/4): updates/7/x86_64/primary_db | 5.9 MB
00:00:02
(4/4): base/7/x86_64/primary_db | 6.0 MB
00:00:02
repo id repo name
status
base/7/x86_64 CentOS-7 - Base
10,097
extras/7/x86_64 CentOS-7 - Extras
307
updates/7/x86_64 CentOS-7 - Updates
1,010
repolist: 11,414
  • 修改为从阿里云下载软件
http://mirrors.aliyun.com/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOSBase.
repo.backup
#
wget curl 用于下载软件
wget centos 7 中 默认没有安装
curl -o /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.aliyun.com/repo/Centos-7.repo
[root@oldboyedu ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name
status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com
10,097
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com
307
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com
1,010
repolist: 11,414
  • 增加epel源
curl -o /etc/yum.repos.d/epel.repo
http://mirrors.aliyun.com/repo/epel-7.repo
[root@oldboyedu ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name
status
base/7/x86_64 CentOS-7 - Base -
mirrors.aliyun.com 10,097
epel/x86_64 Extra Packages for
Enterprise Linux 7 - x86_64 12,584
extras/7/x86_64 CentOS-7 - Extras -
mirrors.aliyun.com 307
updates/7/x86_64 CentOS-7 - Updates -
mirrors.aliyun.com 1,010
repolist: 23,998

2. Linux必备工具详解

  • 必安装的工具
  • yum install -y tree
tree vim wget bash-completion bash-completion-extras
lrzsz net-tools sysstat iotop iftop htop unzip nc nmap
telnet bc psmisc httpd-tools bind-utils nethogs cowsay sl
#删除linux下面 yum缓存
[root@oldboyedu ~]# yum clean all
命令 作用
tree 以树形显示目录结构 ls
psmisc pstree等命令
vim vi升级版
wget 下载工具
bash-completion(默认源) 自动补全增强工具,可以补全命令参数
bash-completionextras(epel) 自动补全超级增强工具,可以补全命令参数
lrzsz 上传下载工具 rz和sz
net-tools ifconfig route命令属于的软件包
sysstat sar iostat 属于的软件包
iotop 查询系统每个进程的io读写情况 swap写入情况
iftop 查询网络流量情况
nethogs 显示每个进程的流量情况
htop top升级版
unzip 解压
nc ncat 类似telnet
nmap 网络扫描工具
telnet 检查端口是否开启
bc 基础计算器
lsof 显示所有被打开的文件
dig DNS解析 bind-utils软件包
nslookup DNS解析 bind-utils软件包
host DNS解析 bind-utils软件包
htpasswd 创建密码文件 存放用户名和加密的密码 一般用于nginx 简单认证中

3. 娱乐命令

[root@oldboyedu ~]# cowsay "列害了我的哥"
[root@oldboyedu ~]# animalsay "厉害了我的导"

4. 必备工具

#1. tree 以树形显示目录结构
## -L 2 显示目录中最多 几层内容
tree -L 1
[root@oldboyedu ~]# tree -L 1 /
/
├── bin -> usr/bin
├── boot
├── dataa
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib64
├── lidao
├── media
├── mnt
├── oldboy
├── oldboy.tar.gz
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── srv
├── sys
├── tmp
├── usr
└── var
22 directories, 1 file
#2. vim vi升级版
#3. wget 下载指定的文件
wget www.baidu.com
#下载到指定目录 使用 -P 如果目录不存在 则wget自动创建
默认下载到当前目录
[root@oldboyedu ~]# wget -P
/oldwang/lidao/oldboy/alex/ddd/xxxx/oooo/ www.baidu.com
#4. 自动补全增强版
安装完成后 第1次使用需要重新登录(窗口 断开 重新连接)
bash-completion(默认源)自动补全增强工具,可以补全命令参数
bash-completion-extras(epel)自动补全超级增强工具,可以补全命令参数
#5. bc basic calc 计算器
## -l 显示带小数
[root@oldboyedu ~]# bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free
Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
1/3
.33333333333333333333
10/3
3.33333333333333333333
10+1-999*999/222
-4484.50000000000000000000
#6. lrzsz rz和sz
#7. htop
#8. nmap

你可能感兴趣的:(2020-01-07)