1.使用tar命令对文件进行打包压缩与解压缩:
使用gzip方式对文件进行压缩,并指定压缩名为 tar_gzip.tar.gz
使用bzip2方式对文件夹进行压缩,并指定压缩名为 tar_bzip2.tar.bz2
使用xz方式对文件进行压缩,并指定压缩名为 tar_xz.tar.xz
新建文件file1.txt,file2.txt,file3.txt
对文件file1.txt和file2.txt,进行压缩(使用gzip方式),排除file3.txt(即不对file3进行压缩)
并指定压缩名为tar_file.tar.gz
新建文件file4.txt,将file4.txt添加到tar_file.tar.gz中
解压tar_gzip.tar.gz到指定目录tar_test(没有这个目录就创建)
解压tar_xz.tar.xz
(1)使用 gzip 方式对文件进行压缩,并指定压缩名为 tar_gzip.tar.gz:\
(2):使用bzip2方式对文件夹进行压缩,并指定压缩名为tar_bzip2.tar.bz2:
(3):使用xz方式对文件进行压缩,并指定压缩名为tar_xz.tar.xz:
(4):新建文件file1.txt,file2.txt,file3.txt
(5):对文件file1.txt和file2.txt,进行压缩(使用gzip方式),排除file3.txt(即不对file3进行压缩)并定压缩名为tar_file.tar.gz
(6):新建文件file4.txt,将file4.txt添加到tar_file.tar.gz中
(7): 解压tar_gzip.tar.gz到指定目录tar_test(没有这个目录就创建) 解压tar_xz.tar.xz
[root@localhost test]# mkdir tar_test
[root@localhost test]# tar -xvf tar_filr.tar.gz -C tar_test
file1.txt
file2.txt
file3.txt
file4.txt
[root@localhost test]# ls
file1.txt file2.txt file3.txt file4.txt tar_filr.tar.gz tar_test
[root@localhost test]# ls ./tar_test/
file1.txt file2.txt file3.txt file4.txt
[root@localhost test]#
[root@localhost test]# xz tar_xz.tar.xz file*.txt
[root@localhost test]# ls
file1.txt.xz file3.txt.xz tar_filr.tar.gz
file2.txt.xz file4.txt.xz tar_test
[root@localhost test]# unxz file*
[root@localhost test]# ls
file1.txt file2.txt file3.txt file4.txt tar_filr.tar.gz tar_test
[root@localhost test]#
2.在Linux上的/root目录创建一个Linux.txt,在windows上创建windows.txt
通过sftp的 get和put命令,将windows上的windows.txt推送到linux上
通过sftp的 get和put命令,将linux上的linux.txt推送到windows上
sftp> pwd
Remote working directory: /root
sftp> lpwd
Local working directory: c:\users\administrator
sftp> lcd C:\Users\Administrator\.local
sftp> lpwd
Local working directory: c:\users\administrator\.local
sftp> cd /root/test
sftp> pwd
Remote working directory: /root/test
sftp> put windows.txt
Uploading windows.txt to /root/test/windows.txt
windows.txt 100% 0 0.1KB/s 00:00
sftp> EXIT
C:\Users\Administrator>sftp root@192.168.176.130
root@192.168.176.130's password:
Connected to 192.168.176.130.
sftp> lpwd
Local working directory: c:\users\administrator
sftp> lcd C:\Users\Administrator\.local
sftp> cd /root/test
sftp> get tt.txt
Fetching /root/test/tt.txt to tt.txt
/root/test/tt.txt 100% 10 4.9KB/s 00:00
sftp>
3.创建普通变量local_data=1并访问
创建环境变量ROOT_DATA=root, 只有root用户可以访问到
创建环境变量USER_DATA=user, 只有普通用户可以访问到
创建环境变量DATA=all, root用户和普通用户都可以访问到
(1)创建普通变量local_data=1并访问
(2)创建环境变量ROOT_DATA=root, 只有root用户可以访问到
(3)创建环境变量USER_DATA=user, 只有普通用户可以访问到
// 普通用户中
[RHCSA@localhost ~]$ USER_DATA=user
[RHCSA@localhost ~]$ echo $USER_DATA
user
[RHCSA@localhost ~]$
// root中
[root@localhost ~]# echo $USER_DATA
(4)创建环境变量DATA=all, root用户和普通用户都可以访问到
[root@localhost ~]# vim ./.bashrc
[root@localhost ~]# source ./.bash_profile
[root@localhost ~]# echo $DATA
all
[root@localhost ~]#
// 普通用户中
[RHCSA1@localhost ~]# echo $DATA
all
4.创建3个文件test1.txt, test2.txt, test3.txt
使用find查找test1.txt,test2.txt, test3.txt
使用别名: 将上边命令命名为myfind
取消别名
5.查看最近使用的10条历史命令
6.在一行上执行两个命令,打印123和从root切换到普通用户
7.引号的使用举例: 无引号,单引号,双引号,反引号,$()