- 一、软件安装和卸载
- 常用命令:
- 1、yum install -y <软件>
- 二、历史
- 常见用法
- 1、==history==:查看之前对Linux虚拟机所做的操作
- 2、==history N==:显示最近N条命令
- 3、==history -c==:清除所有的历史记录
- 4、==history -w xxx.txt==: 保存历史记录到文本xxx.txt
-
压缩包安装方式:
直接解压,配置相应的环境变量即可。 -
yum安装:
yum集成了连接网络,软件安装,删除,更新等功能,yum在配置好repo后,机器只要连网,就能智能化安装软件。使用yum安装的好处在于可以安装相应的依赖包
| 命令 | 作用 |
|---|---|
| yum install -y | 安装(常用) |
| yum update | 更新、升级 |
| yum info | 显示包信息 |
| yum list | 不限则显示已安装或可安装包 |
| yum remove | 删除程序 |
| yum clean all | 清除所有缓存(包含文件、旧软件) |
(1)举例:安装lrzsz软件
注:最好用yum install -y命令,因为用yum install就需要一直确认
[root@hadoop60 ~]# yum install lrzsz [root@hadoop60 ~]# export declare -x HISTConTROL="ignoredups" declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:" declare -x a="e" [root@hadoop60 ~]# echo $a e [root@hadoop60 ~]# yum install lrzsz 正在解决依赖关系 --> 正在检查事务 ---> 软件包 lrzsz.x86_64.0.0.12.20-36.el7 将被 安装 --> 解决依赖关系完成 用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key)" 指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 软件包 : centos-release-7-3.1611.el7.centos.x86_64 (@anaconda) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 是否继续?[y/N]:y Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : lrzsz-0.12.20-36.el7.x86_64 1/1 验证中 : lrzsz-0.12.20-36.el7.x86_64 1/1 已安装: lrzsz.x86_64 0:0.12.20-36.el7 完毕! [root@hadoop60 ~]#
(2)举例:输入rz命令,按enter,会进入下图所示的页面(Windows本地),选择并双击需要传输的文件,点确定就ok了。
[root@hadoop60 ~]# rz rz waiting to receive. zmodem trl+C ȡ 100% 50 KB 50 KB/s 00:00:01 0 Errors9fedcf7d7.jpg... 0
(3)通过ll查看,发现上传的文件已经在里面了(下图第一个)
[root@hadoop60 ~]# ll 总用量 76 -rw-r--r--. 1 root root 51248 9月 9 15:58 4f3db897a968a2edc505149fedcf7d7.jpg drwxrwxrwx. 2 root root 92 10月 8 08:39 aa drwxr-xr-x. 2 root root 97 10月 8 08:36 ab -rw-r--r--. 1 root root 222 10月 8 08:33 abc.tar.gz -rwxr-xr-x. 1 root root 6 10月 7 22:04 abc.txt lrwxrwxrwx. 1 root root 7 10月 7 09:48 abx.txt -> abc.txt -rw-------. 1 root root 1232 10月 5 08:58 anaconda-ks.cfg -rw-r--r--. 1 root root 6 10月 7 21:59 bac.txt -rw-r--r--. 1 root root 12 10月 7 22:06 b.txt -rwxrwxrwx. 1 root root 30 10月 9 09:40 xyz.txt
注:
(1)rz:上传,sz:下载,一般sz用得少
(2)在哪执行的rz命令,最终文件就上传到哪个目录下面
简介:
(1)history保留了最近执行的命令记录,默认可以保留1000
(2)历史清单从0开始编号到最大值
| 命令 | 作用 |
|---|---|
| history N | 显示最近N条命令 |
| history -c | 清除所有的历史记录 |
| history -w xxx.txt | 保存历史记录到文本xxx.txt |
[root@hadoop60 ~]# history
1 ifconfig
2 ls
3 ll
4 ping www.baidu.com
5 cd /
6 ll
7 cp usr/bin xyz.txt
8 cp run xyz.txt
9 cd .
10 ll
11 cd ..
[root@hadoop60 ~]#
2、history N:显示最近N条命令
[root@hadoop60 ~]# history 10 96 ll 97 vi /etc/sysconfig/network 98 vi /etc/profile 99 rz 100 ll 101 rz 102 yum clean all 103 history N 104 history 105 history 103、history -c:清除所有的历史记录
[root@hadoop60 ~]# history -c [root@hadoop60 ~]# history 1 history4、history -w xxx.txt: 保存历史记录到文本xxx.txt
简介:把history里的w条历史记录导到文本xxx.txt里



