当前位置:网站首页>0717RHCSA
0717RHCSA
2022-07-25 12:59:00 【Psc_February2】
使用tar命令对文件进行打包压缩与解压缩:
使用gzip方式对文件进行压缩,并指定压缩名为 tar_gzip.tar.gz
使用bzip2方式对文件夹进行压缩,并指定压缩名为 tar_bzip2.tar.bz2
使用xz方式对文件进行压缩,并指定压缩名为 tar_xz.tar.xz
[[email protected] ~]# tar czf tar_gzip.tar.gz tar_file1 tar_file2 tar_file3
[[email protected] ~]# tar cjf tar_bzip2.tar.bz2 tar_file1 tar_file2 tar_file3
[[email protected] ~]# tar cJf tar_xz.tar.xz tar_file1 tar_file2 tar_file3
[[email protected] ~]# ls -l
-rw-r--r--. 1 root root 145 Jul 18 13:55 tar_bzip2.tar.bz2
-rw-r--r--. 1 root root 0 Jul 18 13:50 tar_file1
-rw-r--r--. 1 root root 0 Jul 18 13:50 tar_file2
-rw-r--r--. 1 root root 0 Jul 18 13:50 tar_file3
-rw-r--r--. 1 root root 147 Jul 18 13:55 tar_gzip.tar.gz
-rw-r--r--. 1 root root 188 Jul 18 13:56 tar_xz.tar.xz
新建文件file1.txt,file2.txt,file3.txt
对文件file1.txt和file2.txt,进行压缩(使用gzip方式),排除file3.txt(即不对file3进行压缩)
并指定压缩名为tar_file.tar.gz
[[email protected] ~]# tar -cvf tar_file.tar.gz flie[!3].txt flie1.txt flie2.txt [[email protected] ~]#新建文件file4.txt,将file4.txt添加到tar_file.tar.gz中
查看压缩包tar_file.tar.gz有哪些文件及目录(不解压,只查看)
解压tar_gzip.tar.gz到指定目录tar_test(没有这个目录就创建)
[[email protected] ~]# touch file4.txt [[email protected] ~]# tar -rvf tar_file.tar.gz file4.txt file4.txt [[email protected] ~]# tar tf tar_file.tar.gz flie1.txt flie2.txt file4.txt [[email protected] ~]# mkdir tar_test [[email protected] ~]# tar xzf tar_gzip.tar.gz -C tar_test [[email protected] ~]#解压tar_xz.tar.xz
[[email protected] ~]# tar xvf tar_xz.tar.xz tar_file1 tar_file2 tar_file3在Linux上的/root目录创建一个Linux.txt,在windows上创建windows.txt
- 通过sftp的 get和put命令,将windows上的windows.txt推送到linux上
sftp> put C:\Users\jameth\Desktop\Windows.txt /root/ Uploading C:/Users/jameth/Desktop/Windows.txt to /root/Windows.txt C:/Users/jameth/Desktop/Windows.txt 100% 0 0.0KB/s 00:00 sftp>通过sftp的 get和put命令,将linux上的linux.txt推送到windows上
sftp> get /root/Linux.txt C:\Users\jameth\Desktop\ Fetching /root/Linux.txt to C:/Users/jameth/Desktop/Linux.txt sftp>创建普通变量local_data=1并访问
[[email protected] ~]# export local_data=1 [[email protected] ~]# echo $local_data 1创建环境变量ROOT_DATA=root, 只有root用户可以访问到
[[email protected] ~]# vi /root/.bashrc [[email protected] ~]# source /root/.bashrc [[email protected] ~]# echo $ROOT_DATA root创建环境变量USER_DATA=user, 只有普通用户可以访问到
[[email protected] ~]# export USER_DATA=user [[email protected] ~]# echo $USER_DATA user- 创建环境变量DATA=all, root用户和普通用户都可以访问到
[[email protected] ~]# vi /etc/profile [[email protected] ~]# source /etc/profile [[email protected] ~]# echo $DATA all创建3个文件test1.txt, test2.txt, test3.txt
- 使用find查找test1.txt,test2.txt, test3.txt
- 使用别名: 将上边命令命名为myfind
- 取消别名
[[email protected] ~]# touch test1.txt [[email protected] ~]# touch test2.txt [[email protected] ~]# touch test3.txt [[email protected] ~]# find test[1-3].txt test1.txt test2.txt test3.txt [[email protected] ~]# alias myfind=find [[email protected] ~]# myfind test[1-3].txt test1.txt test2.txt test3.txt [[email protected] ~]# unalias myfind [[email protected] ~]# myfind test[1-3].txt bash: myfind: command not found... [[email protected] ~]#查看最近使用的10条历史命令
[[email protected] ~]# history 10 122 find test[1-3].txt 123 touch test1.txt 124 touch test2.txt 125 touch test3.txt 126 find test[1-3].txt 127 alias myfind=find 128 myfind test[1-3].txt 129 unalias myfind 130 myfind test[1-3].txt 131 history 10在一行上执行两个命令,打印123和从root切换到普通用户
[[email protected] ~]# printf 123 ; su rhcsa 123[[email protected] root]$引号的使用举例: 无引号,单引号,双引号,反引号,$()
[[email protected] ~]# numb=1 [[email protected] ~]# echo "$numb" 1 [[email protected] ~]# echo '$numb' $numb [[email protected] ~]# n=pwd [[email protected] ~]# echo $n pwd [[email protected] ~]# n=`pwd` [[email protected] ~]# echo $n /root [[email protected] ~]# n=$(ls) [[email protected] ~]# echo $n aafile afile anaconda-ks.cfg args.txt a.txt bbfile bfile cut_data.txt Desktop Documents Downloads f1 f2 f3 file1 file2 file4.txt flie1.txt flie2.txt flie3.txt info_txt initial-setup-ks.cfg Linux.txt Music num.txt Pictures Public sort2.txt sort_args.txt sorted_args.txt sorted_merge.txt sorted_num.txt sort.txt tar_bzip2.tar.bz2 tar_file1 tar_file2 tar_file3 tar_file.tar.gz tar_gzip.tar.gz tar_xz.tar.xz Templates test1.txt test2.txt test3.txt uniq_data.txt Videos Windows.txt zfile zzfile [[email protected] ~]#
边栏推荐
- Lu MENGZHENG's "Fu of broken kiln"
- Shell common script: get the IP address of the network card
- ECCV 2022 | 登顶SemanticKITTI!基于二维先验辅助的激光雷达点云语义分割
- A turbulent life
- Mid 2022 review | latest progress of large model technology Lanzhou Technology
- 卷积神经网络模型之——LeNet网络结构与代码实现
- Cyberspace Security penetration attack and defense 9 (PKI)
- AtCoder Beginner Contest 261 F // 树状数组
- Docker learning - redis cluster -3 master and 3 slave - capacity expansion - capacity reduction building
- 【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
猜你喜欢

Zero basic learning canoe panel (15) -- CAPL output view

卷积神经网络模型之——VGG-16网络结构与代码实现

【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)

好友让我看这段代码

Docekr learning - MySQL 8 master-slave replication setup deployment
![[ai4code final chapter] alphacode: competition level code generation with alphacode (deepmind)](/img/05/86eed30a7c063beace400a005e4a4c.png)
[ai4code final chapter] alphacode: competition level code generation with alphacode (deepmind)

485 communication (detailed explanation)

如何用因果推断和实验驱动用户增长? | 7月28日TF67

Connotation and application of industrial Internet

ESP32-C3 基于Arduino框架下Blinker点灯控制10路开关或继电器组
随机推荐
Clickhouse notes 03-- grafana accesses Clickhouse
我的创作纪念日
深度学习的训练、预测过程详解【以LeNet模型和CIFAR10数据集为例】
Shell common script: check whether a domain name and IP address are connected
【AI4Code】《Pythia: AI-assisted Code Completion System》(KDD 2019)
【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
使用vsftpd服务传输文件(匿名用户认证、本地用户认证、虚拟用户认证)
Requirements specification template
Docker learning - redis cluster -3 master and 3 slave - capacity expansion - capacity reduction building
【重温SSM框架系列】15 - SSM系列博文总结【SSM杀青篇】
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing
The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
A turbulent life
Shell Basics (exit control, input and output, etc.)
TCP的拥塞控制
MLX90640 红外热成像仪测温传感器模块开发笔记(五)
ECCV2022 | TransGrasp类级别抓取姿态迁移
Shell常用脚本:检测某域名、IP地址是否通
[today in history] July 25: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone