Basic Unix Commands Every Developer Should Know
Basic Unix Commands Every Developer Should Know
A compact reference to the most useful Unix commands for developers and Salesforce engineers. Copy, paste, and practice these commands directly in your terminal.
Unix commands help you move faster in projects, debug issues, and work with repositories without relying only on a GUI. If you are a Salesforce, backend, or full-stack developer, knowing these basics will save you a lot of time in the terminal.
Below is a simple one-page guide you can use as a quick reference while working.
Detailed Commands and Examples
pwd — Print Working Directory
navigation
Shows the full path of the folder you are currently in. Very helpful when you feel lost in the terminal.
pwd
ls — List Files and Folders
files & folders
Displays all files and directories inside the current folder.
ls
Common options:
ls -l # long format with details
ls -a # show hidden files
cd — Change Directory
navigation
Used to move between folders. You can also use the up and down arrow keys in the terminal to browse previous commands.
cd <folder-name> # go into a folder
cd .. # go one level up
cd ../ # same as above, go one level up
cd ~ # go to your home directory
cd /path/to/folder # go to a specific path
mkdir — Create a Directory
project setup
Creates a new folder (directory) inside your current location.
mkdir myProject
mkdir src
mkdir logs
touch — Create a File
files
Creates a new empty file. Very useful for quick script or config file creation.
touch index.js
touch test.cls
touch README.md
open — Open a File (macOS)
open file
Opens a file or directory with the default application (mainly on macOS).
open index.js
open myProject/
rm — Remove Files
delete
Deletes one or more files from the current directory.
rm file.txt
rm app.log
rm deletes permanently (no recycle bin).
rm * — Remove All Files in a Folder
delete all
Removes all files (not folders) in the current directory.
rm *
rm -r — Remove a Directory
delete folder
Deletes a directory and its contents recursively.
rm -r directoryName/
rm -r logs/
cp — Copy Files and Folders
copy
Copies files or directories from one location to another.
cp file1.txt file2.txt # copy file1.txt to file2.txt
cp -r folder1 folder2 # copy folder1 into folder2
mv — Move or Rename Files
move / rename
Moves files between folders or renames them.
mv oldName.txt newName.txt # rename a file
mv file.txt folder/ # move file.txt into folder
mv *.log logs/ # move all .log files into logs/
cat — Show File Contents
view file
Prints the contents of a file directly in the terminal.
cat myfile.txt
cat config.json
grep — Search Text in Files
search
Searches for specific text inside files. Helpful when scanning Salesforce metadata or log files.
grep "trigger" *.cls # search for the word "trigger" in all .cls files
grep "ERROR" app.log # find lines containing "ERROR" in app.log
echo — Print Text
output
Prints text to the terminal. Often used while writing scripts.
echo "Hello World"
echo "Deploying Salesforce metadata..."
code . — Open Folder in VS Code
vs code
Opens the current directory in Visual Studio Code (after you have installed the code command in PATH).
code .
Comments
Post a Comment