查看linux的分区 大小,centos查看分区
很多朋友对于查看linux的分区 大小和centos查看分区不太懂,今天就由小编来为大家分享,希望可以帮助到大家,下面一起来看看吧!
如何查看linux根分区下所有目录及文件的大小
使用ls命令 ls-al
ls命令用于显示目录中的文件信息,格式为:“ls [选项] [文件]”。
Linux命令:
当咱们处在不同的工作目录下时,能够直接看到的文件也会发生变化,便可以通过ls命令的“-a”参数来看到全部文件(包括隐藏文件),再结合“-l”参数来查看文件的属性、大小等详细信息,整合之后的命令效果是这样的:
[root@linuxprobe~]#ls-al
total60
dr-xr-x---.14rootroot4096May407:56.
drwxr-xr-x.17rootroot4096May415:55..
-rw-------.1rootroot1213May415:44anaconda-ks.cfg
-rw-------.1rootroot957May407:54.bash_history
-rw-r--r--.1rootroot18Dec282013.bash_logout
-rw-r--r--.1rootroot176Dec282013.bash_profile
-rw-r--r--.1rootroot176Dec282013.bashrc
drwx------.10rootroot4096May407:56.cache
drwx------.15rootroot4096May407:49.config
-rw-r--r--.1rootroot100Dec282013.cshrc
drwx------.3rootroot24May407:46.dbus
drwxr-xr-x.2rootroot6May407:49Desktop
drwxr-xr-x.2rootroot6May407:49Documents
drwxr-xr-x.2rootroot6May407:49Downloads
-rw-------.1rootroot16May407:49.esd_auth
-rw-------.1rootroot628May407:56.ICEauthority
-rw-r--r--.1rootroot1264May407:48initial-setup-ks.cfg
drwx------.3rootroot18May407:49.local
drwxr-xr-x.2rootroot6May407:49Music
drwxr-xr-x.2rootroot6May407:49Pictures
drwxr-xr-x.2rootroot6May407:49Public
-rw-r--r--.1rootroot129Dec282013.tcshrc
drwxr-xr-x.2rootroot6May407:49Templates
drwxr-xr-x.2rootroot6May407:49Videos
-rw-------.1rootroot1962May407:54.viminfo
如果需要看目录文件信息的话,需要额外添加一个-d参数才可以,例如查看/etc目录中文件的权限与属性:
[root@linuxprobe~]# ls-ld/etc
drwxr-xr-x. 132 root root 8192 Jul 10 10:48/etc
如何在Linux中查看分区大小linux查看分区大小
Linux操作系统是一种功能强大的操作系统,在许多应用程序和服务器中都有广泛应用。系统管理员和用户经常需要查看 Linux系统中的分区大小。比如,在 Linux中安装新的应用程序时,你需要搞清楚可用的分区大小来确保有足够的空间来安装新的应用程序。
要查看 Linux中的分区大小,最简单的方法是使用终端窗口,也就是系统的命令行界面。可以通过在终端中输入 fdisk-l来查看所有分区的大小。这样,你能看到磁盘上每个分区的大小和它们所使用的文件系统类型。
也可以使用 Ubuntu发行版包含的“Disks”(磁盘)应用程序来查看 Linux中的分区大小。Disks可以让你以视觉化方式查看和管理磁盘和分区,以及获取有关这些分区的信息,包括分区大小,剩余可用空间等。例如,要查看系统的磁盘的大小,只需在终端输入 disks并打开应用程序。随后,你便可以看到磁盘的大小和剩余可用空间。
有时,需要查看更详细的分区信息才能进行系统配置。这是在你需要手动操作分区时非常有用,比如分区大小,磁盘类型和文件系统类型。为此,可以使用 fdisk命令。它是内置的系统工具,可以准确显示 Linux中的分区大小,包括其文件系统类型。举例来说,如果要查看系统最大的分区,可以在终端中输入以下命令:
fdisk-l/dev/hda| grep Linux
此命令将返回当前使用的 Linux分区的信息,包括分区大小和文件系统类型等。
总而言之,查看 Linux中的分区大小非常简单,可以使用终端命令行或 Ubuntu发行版中的“磁盘”应用程序来轻松实现此操作。对于更详细的分区信息,可以使用 fdisk命令来查看。
linux磁盘分区方法
产品型号:Thinkpad E15
系统版本:centos8
案例:在sdb盘上建一个分区,大小为1G
在虚拟机上添加一块硬盘
例:对sdb这块盘划分一个100M的分区出来
[root@xuegod63~]# fdisk/dev/sdb
...
Command(m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition删除分区
g create a new empty GPT partition table
G create an IRIX(SGI) partition table
l list known partition types显示分区类型
m print this menu打印帮助菜单
n add a new partition添加新的分区
o create a new empty DOS partition table
p print the partition table显示分区表
q quit without saving changes不保存,退出
s create a new empty Sun disklabel
t change a partitions system id改变分区类型
u change display/entry units
v verify the partition table
w write table to disk and exit写分区表信息到硬盘,保存操作并退出
x extra functionality(experts only)
Command(m for help): p-----打印分区表
Command(m for help): n----新建一个分区
Partition type:
p primary(2 primary, 0 extended, 2 free) p:主分区
e extended e:扩展分区
Select(default p):--#直接默认
Using default response p
Partition number(1,4, default 1):---#直接默认
First sector(1230848-41943039, default 1230848):---#直接默认
Using default value 1230848
Last sector,+sectors or+size{K,M,G}(1230848-41943039, default 41943039):+1G
#输入分区大小
Partition 3 of type Linux and of size 1 GiB is set
Command(m for help): w#保存退出
格式化并创建文件系统
[root@xuegod63~]# mkfs.xfs/dev/sdb1
注:-f参数可以对已经存在文件系统的分区,强制格式化
[root@xuegod63~]# mkdir/sdb1#创建挂载点
[root@xuegod63~]# mount/dev/sdb1/sdb1/#挂载
[root@xuegod63~]# df-h#查看