当前位置:网站首页>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] ~]#
边栏推荐
- Machine learning strong foundation program 0-4: popular understanding of Occam razor and no free lunch theorem
- 并发编程 — 内存模型 JMM
- 【运维、实施精品】月薪10k+的技术岗位面试技巧
- 【视频】马尔可夫链蒙特卡罗方法MCMC原理与R语言实现|数据分享
- 零基础学习CANoe Panel(12)—— 进度条(Progress Bar)
- 程序的内存布局
- Memory layout of program
- 外围系统调用SAP的WebAPI接口
- Shell常用脚本:检测某域名、IP地址是否通
- The programmer's father made his own AI breast feeding detector to predict that the baby is hungry and not let the crying affect his wife's sleep
猜你喜欢

Docekr learning - MySQL 8 master-slave replication setup deployment

Chapter5 : Deep Learning and Computational Chemistry

Shell common script: get the IP address of the network card
![Detailed explanation of switch link aggregation [Huawei ENSP]](/img/34/dff118b52404e35f74a8f06b2517be.png)
Detailed explanation of switch link aggregation [Huawei ENSP]

Zero basic learning canoe panel (16) -- clock control/panel control/start stop control/tab control

Word style and multi-level list setting skills (II)

cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘

Masscode is an excellent open source code fragment manager

A hard journey

VIM tip: always show line numbers
随机推荐
Convolutional neural network model -- lenet network structure and code implementation
Chapter5 : Deep Learning and Computational Chemistry
Selenium use -- installation and testing
Business visualization - make your flowchart'run'(3. Branch selection & cross language distributed operation node)
Shell Basics (exit control, input and output, etc.)
基于JEECG制作一个通用的级联字典选择控件-DictCascadeUniversal
R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
Simple understanding of flow
B树和B+树
Vim技巧:永远显示行号
部署Apache网站服务以及访问控制的实现
深度学习的训练、预测过程详解【以LeNet模型和CIFAR10数据集为例】
Detailed explanation of switch link aggregation [Huawei ENSP]
网络空间安全 渗透攻防9(PKI)
OAuth, JWT, oidc, you mess me up
Shell common script: check whether a domain name and IP address are connected
2022 年中回顾 | 大模型技术最新进展 澜舟科技
Clickhouse notes 03-- grafana accesses Clickhouse