Home / Log

How to Enable Command Line Access to Cursor AppImage

To start an AppImage from the CLI while respecting given folder or file inputs and ignoring other output to stdout, you can use the following approach:

  1. First, create an alias for the AppImage:
alias cursor="~/AppImages/cursor.appimage"

You can add this line to your ~/.bashrc or ~/.zshrc file to make it permanent.

  1. To run the AppImage with file or folder inputs while ignoring stdout, you can use this command structure:
cursor "$@" > /dev/null 2>&1 &

Let’s break this down:

  1. To make this easier to use, you can create a function in your ~/.bashrc or ~/.zshrc:
cursor() {
    ~/AppImages/cursor.appimage "$@" > /dev/null 2>&1 &
}

export -f cursor # optional

After adding this function and sourcing your shell configuration file (or restarting your terminal), you can use the cursor command as desired:

cursor file.txt
cursor .
cursor folder

This approach will:

  1. Start the Cursor AppImage
  2. Pass any arguments you provide (file, folder, etc.) to the AppImage
  3. Ignore any output to stdout
  4. Run the process in the background, allowing you to continue using your terminal

Remember to adjust the path if your AppImage location is different from what’s shown here.

Date
14.08.2024
Categories
  • Linux
  • WebDev
Tags
  • bash
  • zsh
  • cursor