Linux cmd

curl和wget的区别和使用

curl和wget基础功能有诸多重叠,curl由于可自定义各种请求参数所以在模拟web请求方面更擅长;wget由于支持ftp和Recursive所以在下载文件方面更擅长。

1.下载文件

curl -O http://man.linuxde.net/text.iso                    #O大写,不用O只是打印内容不会下载
wget http://www.linuxde.net/text.iso                       #不用参数,直接下载文件

2.下载文件并重命名

curl -o rename.iso http://man.linuxde.net/text.iso         #o小写
wget -O rename.zip http://www.linuxde.net/text.iso         #O大写

CentOs安装chrome

# 如果没有安装wget用下面这个命令 -y表示在后续提示是否安装中输入y
# yum -y install wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum localinstall google-chrome-stable_current_x86_64.rpm

CentOs安装字体

yum -y install fontconfig
yum -y install ttmkfdir
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
mkdir -p /usr/share/fonts/chinese
上传宋体至上面这个文件夹
chmod -R 755 /usr/share/fonts/chinese
fc-cache
# 下面这两个如果fonts.conf里没有这个配置的话加上
# vim /etc/fonts/fonts.conf
# <dir>/usr/share/fonts/chinese</dir>

CentOs安装ifconfig

yum search ifconfig
yum install net-tools.x86_64 -y

CentOs换源

# 先备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 下载说明使用wget下载到上述目录内。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache

CentOs指定yum安装软件路径

yum -c /etc/yum.conf --installroot=/opt/all_venv/ --releasever=/  install nginx
# -c /etc/yum.conf     指定yum配置文件地址
# --installroot=/usr/local    指定自定义的安装目录
# --releasever=/  指定yum源的临时版本

tar

tar -zxvf Xxx.tar.gz -C /opt/module/
# -z 代表gzip,使用gzip工具进行压缩或解压
# -x 代表extract,解压文件(压缩文件是-c)
# -v 代表verbose,显示解压过程(文件列表)
# -f 代表file,指定要解压的文件名(or 要压缩成的文件名)
# -C 解压目录

Centos 安装、升级、卸载RPM程序包

rpm

cat

# 显示或连接多个文本文件。
cat /var/log/mysqld/log | grep password  # grep表示正则

配置环境变量

vim /etc/profile.d/my_env.sh

source

source /etc/profile # 刷新当前shell环境变量

tail

tail -f 10 file #一直变化的文件总是显示后10行
# -f 显示文件最新追加的内容

echo

echo hello >> a.txt
# > 重定向文件时,覆盖文件原有内容
# >> 追加内容

查看linux内核版本

uname -a

查看linux发行版本

lsb_release -a

唤出cmd

ctrl+alt+t
posted @ 2022-04-16 16:06  云轻YK  阅读(55)  评论(0编辑  收藏  举报