-
Notifications
You must be signed in to change notification settings - Fork 0
Bash Tutorial
While KiCAD has a nice GUI to use, many applications are based upon CLI's (command-line interfaces). These applications are interacted with purely through text commands, with all inputs and outputs being text, which gives them more efficiency and automatability at the expense of intution.
Git, our collaboration tool, is natively a CLI application, so its GUI often doesn't meet our needs. Many other applications that ECE/CS majors use are also based upon CLIs, so learning to use one early on is very important.
For this reason I require that all members learn to use Git with Bash, the most common CLI, as a basic skill. This tutorial will show everything from Git Bash which is installed alongside the Windows version of Git, however everything will be the same in the Mac and Linux terminals.
Open your terminal application. If on Windows, use Git Bash since it's packaged alongside git. For macOS and Linux, use the Terminal application.
Windows users:
You can open Git Bash directly from the file explorer using the "Open GIT Bash here" option after right-clicking.


The green text is your device and username.
The yellow ~ is your working directory, the "~" specifically being shorthand for the "home" directory, which changes depending on your user. This will change to other file paths as you change directories.
The $ is the line you can type a command or option on. If it isn't there, your computer is probably busy with a previous command.
This prints out your working directory, also given in the yellow text.

Will list sub-directories and files in the given path, which is the working directory by default.
Adding -lor -a will add details or show hidden files respectively.

Any file path you type is relative to your current one, unless starting with a '/' to indicate an absolute file path.
Assuming you installed KiCAD with default configurations, cd ~/Documents/Kicad/9.0/projects will bring you to your KiCAD projects folder.
A
..means one directory above
Double tap tab to have it list options if you're lost

Typing out multiple names will create multiple files.

Creates a directory.

Moves a directory or file. Can also be used to rename a file by doing mv <old.ext> <new.ext>

Works the same as mv, except copies the file/directory.
A
.means current directory

This is a VERY dangerous command as it instantly deletes the file with no recovery. Make sure you are deleting exactly what you want.
Delete a directory and everything in it with
rm -r <path/dir>. Usingrm -rfwith the extra f will force remove everything.

- Everything is case-sensitive, and spaces do matter as they break up arguments/modifiers
- Normal key commands like
Ctrl + CandCtrl + Vdon't have the same functions as they normally do, use right click instead - Hit tab to autocomplete as you type a file name or path. Double tap to list the available options in your working directory
If it doesn't work, there may be multiple options with what you've typed, or you typed something wrong - Use the up and down arrows to view past commands
-
Ctrl + Rwill let you search past commands with what you type -
Ctrl + Lwill clear out the terminal window -
Ctrl + Awill move your cursor to the beginning of your command -
Ctrl + Ewill move your cursor to the end of your command
This tutorial is just a start, there is much you can do with Bash scripting.
I encourage you to use AI tools to help learn about Bash, they generally handle scripting problems and questions well.
After playing around with these commands to get a feel for them, please move on to the Git Usage page
Please message the electrical chat on the discord if you have any questions!