A petition filed in the wrong court, or on the wrong form, loses time you may not have. These links go to what each court publishes. Check them against the current local rules and any judge-specific requirements before you file.
Which court, and on what terms
A person in custody under the judgment of a state court in a state with two or more federal districts may file in the district where they are in custody, or in the district where the convicting court sat. Both districts have concurrent jurisdiction. Texas has four districts, so a Texas prisoner usually has a choice of two.
A federal prisoner's motion goes back to the court that imposed the sentence — not to the district of confinement, and not to the court of appeals.
District courts may grant the writ within their respective jurisdictions. Two of the Texas districts write their habeas filing guidance around § 2241 petitions, so read those pages with the vehicle in mind: § 2241 reaches custody under federal authority and custody in violation of federal law, while a federal prisoner's attack on the sentence itself goes under § 2255.
File the petition with the clerk, with the filing fee or a request to proceed without prepaying. The clerk files it even if it is not in the form the rules require, and the judge may then direct that it be amended.
The filing fee on an application for a writ of habeas corpus is $5. That is the statutory figure; ask the clerk how each district collects it.
An appeal from the denial of § 2254 or § 2255 relief needs a certificate of appealability. The district judge rules first; if it's denied, a circuit judge may issue one, and a notice of appeal counts as a request.
U.S. Court of Appeals for the Fifth Circuit
Appeals from all four Texas districts, plus Louisiana and Mississippi.
Eastern District of Texas
Beaumont, Lufkin, Marshall, Sherman, Texarkana, and Tyler divisions.
Northern District of Texas
Abilene, Amarillo, Dallas, Fort Worth, Lubbock, San Angelo, and Wichita Falls divisions.
Southern District of Texas
Brownsville, Corpus Christi, Galveston, Houston, Laredo, McAllen, and Victoria divisions.
Western District of Texas
Austin, Del Rio, El Paso, Midland-Odessa, Pecos, San Antonio, and Waco divisions.
National forms and rules
Background reading
This site stays with rule and statute text. Federal habeas also turns on a large body of case law — deference, exhaustion, procedural default, retroactivity, harmless error, actual innocence. For a free overview of that landscape, Congress's own research service publishes one, and it is a government work in the public domain.
Divisions are listed as each court describes them; check the court's own division and venue pages before filing. Links go to the courts' own sites, which change without notice.
Federal stage 6: § 2254 · Federal stage 7: § 2255 · Federal stage 8: appealing a habeas denial