A shell scripting workspace is the folder, terminal, editor and backup habit you use before any script is written. Set it up once in roughly 20–30 minutes, then start every session in the same place. Keep it small: one workspace folder, three subfolders and one quick test are enough for beginner work.
Choose one dedicated workspace folder
Create a single folder for shell work. On macOS, Linux or WSL, use ~/shell-work; keep the name lowercase and avoid spaces. A fixed path removes the daily question of where a script lives. Run:
mkdir -p ~/shell-work/{scripts,scratch,backups}
cd ~/shell-work
pwd
The final command should print /home/yourname/shell-work or /Users/yourname/shell-work. If it prints anything else, stop and correct the path before adding files. This should take 5 minutes. Use a path you can type from memory. If your name or folder contains a space, quote it every time (cd "$HOME/shell-work"); paths without spaces are less error-prone for beginners.
Confirm the shell and terminal you will use
Open the terminal and check which shell is running:
echo $SHELL
ps -p $$ -o comm=
Use one shell for your first month—usually Bash or Zsh on macOS/Linux—rather than switching between shells when a command fails. On Windows, do shell scripting inside WSL rather than in Command Prompt or PowerShell, because the syntax and file paths differ. Set the terminal font to 12–14 pt and the window to at least 80 columns by 24 rows. High contrast and a readable font reduce avoidable typing errors. If the two commands disagree, close the terminal, open a new one, and check again; the shell running in the current tab is the one that matters. Write the shell name on a sticky note beside the screen for the first week.
Arrange two terminal tabs, not ten
Use two tabs: one for running commands and one for checking paths or logs. A third tab is acceptable if you need a separate test session, but more tabs make it easy to run a script from the wrong folder. Set the terminal profile to open in ~/shell-work if your terminal supports a starting directory; otherwise run cd ~/shell-work as the first command of every session. A 5-minute habit check is enough: open terminal, run pwd, confirm the workspace path, then begin. Do not resize the terminal to a tiny window to fit more on screen; a cramped 40-column window hides error messages and wraps commands confusingly. Keep the prompt visible and clear the screen with clear before a new task.
Create a simple three-folder layout
Keep the layout visible and boring:
shell-work/
scripts/
scratch/
backups/
Save finished practice scripts in scripts, one-off experiments in scratch, and dated copies in backups. Use lowercase names, hyphens instead of spaces, and the .sh extension, for example check-files.sh. Put a one-line note in README.md saying how to run a script from the workspace root. Do not create a deep folder tree; three levels is already more than most beginners need. Keep the workspace root free of loose scripts. If a file is not in scripts, scratch or backups, decide where it belongs or delete it. A tidy root means ls shows only folders and the README, so mistakes stand out.
Configure the editor for shell text
Use the plain-text editor you have already chosen, not a word processor. Set it to UTF-8 encoding and LF line endings, show whitespace, and use four spaces for indentation unless your existing files use another style. Turn off automatic smart quotes: a curly quote can break a shell command. Set the editor font to 13–14 pt, open the whole ~/shell-work folder rather than one file, and place the editor beside the terminal in roughly a 60/40 split. Save files with the .sh extension and keep the syntax highlighting set to shell. Create a notes.md in the workspace root for commands you had to look up. Keep it plain text and date each entry. This is a workspace aid, not a full learning system; three or four lines per session is enough.
Run a five-line workspace check
Create scratch/workspace-check.sh with:
#!/bin/sh
printf 'workspace ready\n'
Make it executable and run it from the workspace root:
chmod +x scratch/workspace-check.sh
./scratch/workspace-check.sh
The output should be workspace ready. This checks the folder path, file permissions and shell execution without becoming a full project. Repeat the check after changing terminal settings, moving the workspace, or restoring a backup. If it fails, use the diagnosis section below before writing more scripts. Run the check twice: once from ~/shell-work and once from another folder using the full path (~/shell-work/scratch/workspace-check.sh). Both should work; the second proves you can run the script without standing in the workspace.
Back up the workspace weekly
Keep one copy outside the workspace folder. A USB drive costing roughly £8–£15 is enough, or use whatever separate drive you already own. Once a week, and before any large edit, copy the workspace with a date suffix such as shell-work-2025-06-01. Keep the last four weekly backups and delete older ones. A beginner workspace usually stays under 50 MB; even with four backups, 100 MB is plenty. This is not a substitute for version control, but it is a simple safety net. Label the backup drive or folder with the machine name and date range. Before restoring, copy the current workspace aside first, so a bad restore does not erase the only working copy.
Diagnose a workspace that will not run scripts
Symptoms: the terminal says permission denied, no such file or directory or command not found; a script runs but prints nothing; edits seem to disappear.
Likely causes: the terminal is not in ~/shell-work; the script lacks execute permission; the shebang line names a shell that is not installed; the file was saved as script.sh.txt; or you are editing one copy while running another.
The fix: run pwd to confirm the folder, ls -la scripts to see permissions and exact names, head -n 1 scripts/name.sh to check the first line, and chmod +x scripts/name.sh to add execute permission. Run local scripts with ./scripts/name.sh from the workspace root. If command not found appears, check echo $PATH and use the explicit ./ path for the file you just created. Move stray .txt files back to .sh, close duplicate editor copies, and rerun the five-line check.
FAQ
How much disk space does this workspace need?
A beginner shell workspace usually needs less than 50 MB. Four dated backups can still fit under 100 MB unless you add large log files.
Is one terminal window enough?
Yes. One window with two tabs is enough for most beginners; use 80 columns by 24 rows as a minimum readable size. Add a third tab only for a separate test session.
Does a shell scripting workspace cost anything?
No. The terminal, shell and plain-text editor are normally free at zero cost. An optional USB backup drive costs about £8–£15.