【Linux】作业2

  1. 使用wget命令在https://www.pearvideo.com/这个网站下载任意一个视频
  2. Linux中的文件类型以及符号的表示
  3. 创建目录test,并使用一条命令在test下创建 test1/test2/test3
    a.输出test3的完整路径
    b.在上面创建的test3目录下创建 file1 并修改文件的修改时间为 20220319
    c.查看file1的详细信息
  1. 任意找出一段视频,找到其网址,比如以下视频网站:https://video.pearvideo.com/mp4/adshort/20220325/cont-1756320-15850227_adpkg-ad_hd.mp4
    在虚拟机上使用wget 命令,如下:
[root@localhost ~]# wget https://video.pearvideo.com/mp4/adshort/20220325/cont-1756320-15850227_adpkg-ad_hd.mp4
--2022-03-26 21:20:51--  https://video.pearvideo.com/mp4/adshort/20220325/cont-1756320-15850227_adpkg-ad_hd.mp4
Resolving video.pearvideo.com (video.pearvideo.com)... 117.161.175.112, 183.201.242.101, 183.201.242.99, ...
Connecting to video.pearvideo.com (video.pearvideo.com)|117.161.175.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19307354 (18M) [video/mp4]
Saving to: ‘cont-1756320-15850227_adpkg-ad_hd.mp4’

cont-1756320-15850227_adpkg-ad_hd.mp4 100%[========================================================================>]  18.41M  2.38MB/s    in 8.3s    

2022-03-26 21:21:00 (2.22 MB/s) - ‘cont-1756320-15850227_adpkg-ad_hd.mp4’ saved [19307354/19307354]
[root@localhost ~]# ls
anaconda-ks.cfg  cont-1756320-15850227_adpkg-ad_hd.mp4  Desktop  Documents  Downloads  Music  original-ks.cfg  Pictures  Public  Templates  Videos
[root@localhost ~]# 

下载完成

  1. Linux常见的文件类型及符号表示有:
    (1)普通文件:符号是 -
    (2)目录文件:符号是 d
    (3)字符设备文件:符号是c
    (4)块设备文件:符号是b
    (5)符号链接文件:符号是l

  2. 使用 mkdir 命令建立文件夹

[root@localhost ~]# mkdir test
[root@localhost ~]# ls
anaconda-ks.cfg                        Desktop    Downloads  original-ks.cfg  Public     test
cont-1756320-15850227_adpkg-ad_hd.mp4  Documents  Music      Pictures         Templates  Videos
[root@localhost ~]# 

在root目录新建test文件夹完成,转到test文件夹,继续新建文件夹

[root@localhost ~]# cd test
[root@localhost test]# mkdir -p test1/test2/test3
[root@localhost test]# ls
test1
[root@localhost test]# cd test1
[root@localhost test1]# ls
test2
[root@localhost test1]# cd test2
[root@localhost test2]# ls
test3
[root@localhost test2]# cd test3

三级文件夹新建完成
a. 在test3 文件夹下使用pwd来查看完整路径

[root@localhost test3]# pwd
/root/test/test1/test2/test3

b. 在test3 文件夹下使用touch命令新建文件file1

[root@localhost test3]# touch file1
[root@localhost test3]# ls
file1
[root@localhost test3]# 

使用touch命令新建file1文件是会伴随更新文件新建的时间

[root@localhost test3]# touch  file1
[root@localhost test3]# ls -l
total 0
-rw-r--r--. 1 root root 0 Mar 26 21:45 file1

想要将时间修改为指定日期,只需要在touch命令后加上参数 -d +年月

[root@localhost test3]# touch -d 20220319 file1
[root@localhost test3]# ls -l
total 0
-rw-r--r--. 1 root root 0 Mar 19 00:00 file1

c. 使用stat + 文件名 来查看文件信息

[root@localhost test3]# stat file1
  File: file1
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 10303h/66307d	Inode: 101784566   Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2022-03-26 21:45:52.644943915 +0800
Modify: 2022-03-26 21:45:52.644943915 +0800
Change: 2022-03-26 21:45:52.644943915 +0800
 Birth: -
[root@localhost test3]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值