Rasberry PI2 file system resizing

can someone give me the exact commands toinput as I am new to linux and the pi. I didn't succeed in resizing the file system...thank you !

Re-size file system

sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:

sudo resize2fs /dev/mmcblk0p2

I don't understand how to input

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w).