The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

How to create a shortcut file to run bash commands

posted on 26.10.2023 by Below Surface in "MacOS"

Open a terminal. Then run:

cd Desktop
nano my_shortcut.command

Then paste the code, that shall be run. In my case it's a shell script, to connect to a server via SSH.

ssh username@ipaddress

Then do this to save and exit the editor:

ctrl + o
hit enter
ctrl + x

Now, a file called my_shortcut.command should have appeared on the desktop. We still need to make it executable:

chmod +x my_shortcut.command

Now the file can be double clicked, to execute the code it contains.


mac os
shell script

More posts of this category

Manually remove iOS backups from a mac computer

How to locate and remove iOS backups from a mac


Installing Homebrew on a M2 MacBook Air from 2022

How to fix: zsh: command not found: brew


Recovery Mode shortcut for a 2012 MacBook Pro

Use this keyboard shortcut to boot into recovery mode