Here you can see 251.0 GB is disk0 and 169.0 GB is disk0s3. I had erased and deleted disk0s2. Now I want to use all the capacity left in disk0 to disk0s2.
You can get the offset and size of the remaining partitions on
disk0 by entering the commands given below.
Note: The identifiers may change if you restart the Mac.
diskutil info disk0s1 | grep -e Offset -e "Disk Size" diskutil info disk0s3 | grep -e Offset -e "Disk Size"
If there is sufficient free space after
disk0s3, then you can reclaim this space, back to the container partition, by entering the command given below.
sudo diskutil apfs resizeContainer disk0s3 0
The macOS operating system offers no commands that can reclaim, back to
disk0s3, any free space that resides before the container partition. There are third party (both free and pay) tools that can move partitions, although some can not handle the APFS format. Also, these types of tools take a long time to execute. You should backup your important data before attempting a move.
It is my opinion that once you have backed up your data, you would be better off wiping the drive and reloading.