老男孩-yum及Linux必背命令

老男孩-yum及Linux必背命令


yum以及Linux必备命令

  1. yum
  2. Linux必备工具详情
    1. 娱乐命令
    2. 必备工具

1.yum

  • yum源:Linux下载软件 软件仓库

    • 默认的yum源是随机地方的 修改到yum源为指定的网站
    • 增加新的yum源:epel
  • yum源配置文件:

[root@oldboyedu ~]# ll /etc/yum.repos.d/
total 40
-rw-r--r--. 1 root root 2523 Jan  7 23:46 CentOS-Base.repo
-rw-r--r--. 1 root root 1664 Nov 23  2018 CentOS-Base.repo.backup
-rw-r--r--. 1 root root 1309 Nov 23  2018 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Nov 23  2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 Nov 23  2018 CentOS-fasttrack.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
-rw-r--r--. 1 root root  664 Jan  7 23:59 epel.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 - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  • 把系统当前的yum源 修改为清华/阿里云下载
#查看Linux当前使用的yum源是什么?
[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         13,510
extras/7/x86_64          CentOS-7 - Extras - mirrors.aliyun.com                    307
updates/7/x86_64         CentOS-7 - Updates - mirrors.aliyun.com                 1,010
repolist: 24,924
  • 修改为 从阿里下载软件

    http://mirrors.aliyun.com/
    
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS.Base.repo.backup
    #
    wget curl 用于下载软件
    wget centos 7 中 默认没有安
    
  • 增加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         13,510
!extras/7/x86_64         CentOS-7 - Extras - mirrors.aliyun.com                    307
!updates/7/x86_64        CentOS-7 - Updates - mirrors.aliyun.com                 1,010
repolist: 24,924

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-completion-extras(epel) 自动补全超级增强工具,可以补全命令参数
lrzsz 上传下载工具rz和sz
net-tools ifconfig route命令属于软件包
sysstat sar iostat属于软件包
iotop 查询网络流量情况
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简单认证中

2.1娱乐命令


#cowsay "奥力给" 奶牛说“奥力给”
[root@oldboyedu ~]# cowsay "奥力给"
 _____
< 奥力给 >
 -----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

[root@oldboyedu ~]# animalsay "我来啦"
 _____
< 我来啦 >
 -----
 \     ____________ 
  \    |__________|
      /           /\
     /           /  \
    /___________/___/|
    |          |     |
    |  ==\ /== |     |
    |   O   O  | \ \ |
    |     <    |  \ \|
   /|          |   \ \
  / |  \_____/ |   / /
 / /|          |  / /|
/||\|          | /||\/
    -------------|   
        | |    | | 
       <__/    \__>

2.2必备工具


#1.tree  以树形显示目录结构
## -L  2   显示目录中最多 几层内容
[root@oldboyedu ~]# tree -L 1 /
/
├── bin -> usr/bin
├── boot
├── data
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib64
├── media
├── mnt
├── myfile
├── oldboy
├── oldzhu
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── srv
├── sys
├── tmp
├── usr
└── var

23 directories, 0 files


#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  计算机
[root@oldboyedu ~]# bc 
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
0

##  -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



##6.lrzsz  rz和sz

##7.htop

##8.nmap

你可能感兴趣的:(老男孩-yum及Linux必背命令)