Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands for disk management under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what are commonly used commands for disk management under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Disk management for Linux is a very important and necessary skill for Linux administrators.

Df command

Df is a Linux command line utility that monitors Linux disk usage. The df command displays a complete summary of the file system disk usage details. "with the-hT option, it displays details about the file system, type, total disk size, used capacity, remaining capacity, utilization, disk installation location, and so on, in an easy-to-read format." Use the-ht option below to display the usage and file system types of all file systems in an easy-to-read format.

[root@localhost ~] # df-hTFilesystem Type Size Used Avail Use% Mounted ondevtmpfs devtmpfs 898M 0898M 0% / devtmpfs tmpfs 910M 0910M 0% / dev/shmtmpfs tmpfs 910M 29M 881M 4% / runtmpfs tmpfs 910M 0910M 0% / sys/fs/cgroup/ Dev/mapper/centos-root xfs 37G 1.6G 36G 5% / / dev/sda1 xfs 1014M 150m 865m 15% / boottmpfs tmpfs 182m 0 182m 0% / run/user/0pydf command

Pydf is a python command-line utility and one of the best alternatives to df commands in Linux. It works like the df command, except that the output is highlighted in different colors. The pydf command is not available by default in CentOS 7.x and RHEL 7.x. If you need to install pydf, you need to install the pippackage manager first, and then use pip to install the pydf tool.

# use the following command to install the piping package manager with yum: [root@localhost ~] # yum-y install python-pip# the following command line is to update the pip package manager: [root@localhost ~] # pip install-- upgrade pip# installs the pydf tool using pip: [root@localhost ~] # pip install pydf

You can install it directly using apt package Manager in ubuntu:

$sudo apt install pydf

Use the following command to display all file systems:

[root@localhost] # pydf-a

Use the-h option below to display disk usage in an easy-to-read format.

[root@localhost ~] # pydf-hFilesystem Size Used Avail Use% Mounted on/dev/centos/root 37G 1624M 35G 4.3 [#] / dev/sda1 1014M 149M 865M 14.7 [# #.] / bootfdiskf command

The fdisk command is one of the most commonly used command-line utilities in Linux to monitor partitions. Fdisk can get all the details about the partitions in the system, and it can also monitor, create, delete, move, and copy any partition in the Linux system. Using the fdisk command, data can also be moved to a new disk.

View all disk partitions

One of the most commonly used arguments in the fdisk command is-l, which lists all available partitions in the Linux system and their device names:

[root@localhost ~] # fdisk-l

View the specified disk

The parameter-l is used to view all available partitions, or you can view details about a specific partition by providing a device name next to the-l parameter, as follows:

Sfdisk command

Sfdisk means scriptable fdisk,sfdisk is a command similar to fdisk, but it has more functionality than fdisk because it can display the partition size in MB.

[root@localhost] # sfdisk-l-uM

Cluster display is used by default, and disk capacity is displayed in MB after using the-uM option.

These are all the contents of this article entitled "what are the common commands for disk management under Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report