5 Terminal Commands Every Salesforce Developer Must Know

R

2025-12-27

5 Terminal Commands Every Salesforce Developer Must Know

If you work with Salesforce every day, the terminal can save you a lot of time. Here are five commands I use often that make day-to-day development easier.


Open the org in browser

sf org open

Opens your default org directly in the browser. No need to copy login URLs or switch apps.

Show org details

sf org display

Displays details of the connected org like username, org ID, and instance URL. Helps to double-check you’re working in the right org.

Export queries to CSV

sf data query --query "SELECT Id, Name, Email FROM Contact LIMIT 100" --result-format csv > contacts.csv

This runs a SOQL query and saves the result into a CSV file called contacts.csv. Useful when you need data for debugging, sharing, or quick checks in Excel.

Query and view in terminal

sf data query --query "SELECT Id, Name FROM Contact LIMIT 5" --result-format csv | column -s, -t

Runs a query and prints the result as a clean table in the terminal. Good for quick looks without creating a file.

Run anonymous Apex from file

sf apex run --file scripts/apex/hello.apex

Runs Apex code from a file, just like Execute Anonymous in Developer Console. Handy for data fixes, tests, or quick scripts.

These are simple commands, but once you start using them daily, they really speed things up.

Here is a bonus command

Save Command

alias openorg="sf org open"

Creates a shortcut for long commands.