cfdisk command in Linux with examples Last Updated : 10 Oct, 2022 Comments Improve Suggest changes 1 Likes Like Report cfdisk command is used to create, delete, and modify partitions on a disk device. It displays or manipulates the disk partition table by providing a text-based "graphical" interface. cfdisk /dev/sda Example: After running you get a prompt like this: Choose gpt from the list. Now you will see a partition table like this: Creating Partitions Using cfdisk: See the available free space. Here we have 20 GB. Select NEW and create a new partition. Use up-down arrow keys to navigate and enter to select.You can do many things with the free space, if you are installing a new system with a command line interface, you can see an option of using the selected space as primary partition. Example: Select the size 2GB. Enter -> and select primary. Similarly we can do a logical partition also. After sizing the partition, select what type do you want, in my case, I am choosing Linux Swap.After selecting the size and type write to the disk: You will see a prompt like this: Options: -h, --help: It displays help text and exit.-L, --color[=when]: Colorize the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled, for the current built-in default see --help output. See also the COLORS section.-V, --version: Display version information and exit.-z, --zero: Start with an in-memory zeroed partition table. This option does not zero the partition table on the disk; rather, it simply starts the program without reading the existing partition table. This option allows you to create a new partition table from scratch or from a sfdisk-compatible script. Other command line commands: While using cfdisk you can use simple commands just like we use in vi editor for saving, inserting etc. The list of commands are as follows: b: Toggle bootable flag of the current partition. It allows the user to select which partition is primary in the bootable drive. Just press b to see the results, no need of using ctrl.d: It will delete the current marked partition, making a free space for new partition.h: Will print the help screen, showing commands used .n: Will create a new partition of the marked free space .q: Will quit the program without writing partitions to the table.s: Will fix the partitions order if they are now in proper array.t: Will allow you to change the partition type, allowing you to select from the list.u: Will dump the disk layout in a specified script file nameW: Will allow the user to write the data to the disk. The user will be asked if he or she wants to write or not by simply taking input "yes" or "no".x: Will allow the user to hide or display all extra information of the partition.Up-Arrow: Will allow the user to move the cursor to the previous partition, like moving up in the given table list.Down-Arrow: This option allows the user to move the cursor to the next partition, next partition because every new partition is placed after the previous partition.Left-Arrow: This option allows the user to enter previous menu item.Right-Arrow: This option allows the user to enter to the next menu item. Example: Sample output when we use "?" or "h" Create Quiz Comment M Madhusudan_Soni Follow 1 Improve M Madhusudan_Soni Follow 1 Improve Article Tags : Linux-Unix linux-command Linux-system-commands Explore Getting Started with LinuxIntroduction to Linux Operating System7 min readLINUX Full Form - Lovable Intellect Not Using XP2 min readDifference between Linux and Windows7 min readLinux Distributions6 min readDifference between Unix and Linux6 min readInstallation with LinuxInstallation of Arch Linux in VirtualBox4 min readFedora Linux Operating System5 min readHow to install Ubuntu on VirtualBox?6 min readHow to Install Linux Mint?3 min readInstallation of Kali Linux in Virtual Machine2 min readHow to Install Linux on Windows PowerShell Subsystem?2 min readHow to Find openSUSE Linux Version?2 min readInstallation of CentOS2 min readLinux CommandsLinux Commands15+ min readEssential Unix Commands7 min readFind Command in Linux with Examples7 min readLinux File SystemLinux File System12 min readLinux File Hierarchy Structure5 min readLinux Directory Structure6 min readLinux KernelLinux Kernel4 min readKernel in Operating System3 min readHow Linux Kernel Boots?11 min readDifference between Operating System and Kernel3 min readLinux Kernel Module Programming: Hello World Program7 min readLinux Loadable Kernel Module7 min readLoadable Kernel Module - Linux Device Driver Development4 min readLinux Networking ToolsNetwork configuration and troubleshooting commands in Linux5 min readHow to configure network interfaces in CentOS?5 min readCommand-Line Tools and Utilities For Network Management in Linux8 min readLinux - Network Monitoring Tools4 min readLinux ProcessProcesses in Linux/Unix5 min readHow to Manage Process in Linux4 min readGetting System and Process Information Using C Programming and Shell in Linux2 min readProcess states and Transitions in a UNIX Process4 min readLinux FirewallLINUX Firewall7 min readiptables command in Linux with Examples7 min readHow to Configure your Linux Firewall - 3 Methods12 min readShell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting7 min readUnderstanding Terminal, Console, Shell and Kernel3 min readHow to Create a Shell Script in linux7 min readShell Scripting - Different types of Variables4 min readBash Scripting - Introduction to Bash and Bash Scripting12 min readBash Script - Define Bash Variables and its types12 min readShell Scripting - Shell Variables6 min readBash Script - Difference between Bash Script and Shell Script4 min readShell Scripting - Difference between Korn Shell and Bash shell3 min readShell Scripting - Interactive and Non-Interactive Shell3 min readShell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ4 min readLinux Administrator SystemWhat is Linux System Administration?6 min readBeginner's Guide to Linux System Administration5 min readHow to Monitor System Usage, Outages and Troubleshoot Linux Servers6 min readLinux - Systemd and its Components3 min readBoot Process with Systemd in Linux3 min readHow to Control Systemd Services on Remote Linux Server2 min readHow to Start, Stop and Restart Services in Linux Using systemctl Command9 min read Like