5-2liunx的终端和运行命令

1.显示当前主机的主机名:hostname

2.执行的程序:ps aux

3.过滤程序:hostname | grep bash 

4.shell类型: echo $SHELL

5.当前支持的shell类型:cd /etc/shells

6.安装shell : yum -y install csh

7.临时修改主机名:hostname centos8

8.永久修改主机名:hostnamectl set-hostname centos8  写到文件中 cat /etc/hostname

9.提示符默认值:echo $PS1(提示符颜色)

10.改变提示符颜色:[\u@\h \w]$    PS1="[\e[1;5;41;33m\][\u@\h \w]\\$\[\e[0m\]"

11.永久保存提示符颜色:vim /etc/profile.d/test.sh

注:ubutu 需要更改(bashrc文件)

12.查看命令是否是内部命令:type hostname

 13.移动文件夹:vm

14.删除缓存路径:bash -d who 生成新的缓存路劲  bash -r  全部清除。

15.列出所有的内外部命令:type -a echo

16:安装wget :     http://mirrors.163.com/centos/7/os/x86_64/Packages/ 安装时出现依赖关系问题,在执行命令(rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm --nodeps --force)后面需要加上--nodeps --force 直接安装不在分析依赖包问题。

17.安装yum:wget http://yum.baseurl.log/download/3.2.28.tar.gz tar xvf yum-3.2.28.tar.gz

18.安装firefox yum -y install firefox   

19.安装上传命令包:yum -y install lrzsz

20.打开firefox 浏览器:

2 firefox
3 export DISPLAY=10.0.0.1:0.0
7 yum provides libGL.so.1 (查看缺少包)
8 yum install libglvnd-glx  (缺少包安装)
9 firefox

注:Centos8于2021年年底停止了服务,大家再在使用yum源安装时候,出现下面错误“错误:Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist”

最终原因是源的问题,解决办法也是解决源的问题。

解决办法如下:

1、进入yum的repos目录

命令:

cd /etc/yum.repos.d/

2、修改所有的CentOS文件内容

命令:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

3、更新yum源为阿里镜像

命令:

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

yum clean all

yum makecache

4、yum安装测试是否可以yum安装

 

posted @ 2023-05-14 16:27  最拉的刺客  阅读(25)  评论(0)    收藏  举报