1、精讲软硬链接
硬链接
软链接
2、压缩和解压缩
tar
指定目录解压缩
[root@c1 day02]# tar zxvf /mnt/day02/day02.tar.gz -C /mnt/day02/yu/
study1.txt
study2.txt
study3.txt
study4.txt
study5.txt
study6.txt
work11/
work22/
work33/
work44/
work55/
zip
[root@c1 day02]# zip -r hello-03.zip work11/ study2.txt
adding: work11/ (stored 0%)
adding: work11/passwd (deflated 58%)
adding: study2.txt (stored 0%)
unzip
[root@c1 day02]# unzip hello-03.zip -d yu/
Archive: hello-03.zip
creating: yu/work11/
inflating: yu/work11/passwd
extracting: yu/study2.txt
[root@c1 day02]# ll yu/
3、文件系统,磁盘分区
内核中的模块:ext4, xfs, vfat
Linux的虚拟文件系统:VFS
用户空间的管理工具:mkfs.ext4, mkfs.xfs,mkfs.vfat
几个跟文件系统和分区相关的命令
df 查看分区
[root@c1 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 80G 13G 68G 16% /
devtmpfs 901M 0 901M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.5M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/sda2 253M 115M 139M 46% /boot
tmpfs 183M 0 183M 0% /run/user/0
[root@c1 /]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 86G 14G 73G 16% /
devtmpfs 944M 0 944M 0% /dev
tmpfs 956M 0 956M 0% /dev/shm
tmpfs 956M 10M 946M 2% /run
tmpfs 956M 0 956M 0% /sys/fs/cgroup
/dev/sda2 265M 121M 145M 46% /boot
tmpfs 192M 0 192M 0% /run/user/0
[root@c1 /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 83580036 13221276 70358760 16% /
devtmpfs 921676 0 921676 0% /dev
tmpfs 932652 0 932652 0% /dev/shm
tmpfs 932652 9720 922932 2% /run
tmpfs 932652 0 932652 0% /sys/fs/cgroup
/dev/sda2 258724 117220 141504 46% /boot
tmpfs 186532 0 186532 0% /run/user/0
mount 挂载分区
[root@c1 /]# mount /dev/sdb1 /study-disk/
[root@c1 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 5.0G 33M 5.0G 1% /study-disk
umount 卸载分区
参数可以是挂载目录,也可是分区
umount /study-disk/
umount /dev/sdb1 卸载的是最后一次挂载的目录
fdisk 分区命令,分区-格式化-挂载使用
[root@c1 ~]# fdisk /dev/sdc # 给sdc磁盘创建分区
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xbee5b979.
Command (m for help): n # 新建分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303):
Using default value 4194303
Partition 1 of type Linux and of size 2 GiB is set
Command (m for help): w #保存
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@c1 ~]# mkfs.xfs /dev/sdc1 # 格式化分区xfs格式
meta-data=/dev/sdc1 isize=512 agcount=4, agsize=131008 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=524032, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@c1 ~]# mkdir /disk-c1 # 创建挂载目录
[root@c1 ~]# mount /dev/sdc1 /disk-c1/ # 将刚才的分区挂载到挂载目录上,可以使用了
[root@c1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 80G 13G 68G 16% /
devtmpfs 901M 0 901M 0% /dev
tmpfs 911M 0 911M 0% /dev/shm
tmpfs 911M 9.6M 902M 2% /run
tmpfs 911M 0 911M 0% /sys/fs/cgroup
/dev/sda2 253M 115M 139M 46% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/sdc1 2.0G 33M 2.0G 2% /disk-c1
mkfs.xfs/mkfs.ext4 格式化文件系统命令
[root@c1 ~]# runlevel
3 5
[root@c1 ~]# init 3
[root@c1 ~]# runlevel
5 3
init 命令
0-6级别
0,关机
1,单用户
2,多用户
3,最常用的,文本(命令行)界面
4,保留
5,第二常用的,桌面
6,重启
刷新内存数据到磁盘
【root@c1 ~]# sync
[root@c1 ~]#
重启操作系统
【root@c1】# init 6
关机
init 0
标签:0807,dev,911M,笔记,0%,c1,tmpfs,root From: https://www.cnblogs.com/yuyongqi/p/17615113.html