cursor
cursor copied to clipboard
Launch Cursor from terminal in Ubuntu
Hi, i can't launch cursor from terminal with command 'cursor', this is frustrating because I have to launch it from .appimage and then open my project folder from GUI. Can someone help me?
Linux command seems to be broken. We're on it! Thank you for your report!
Hi @ale99viv and @jakobFNF
I solved this issue with a simple bash script. Basically this script export a function called code that receive the path with a argument, when path exists, then this script run a Cursor Appimage by default application path.
- create a file called
cursor.sh
in your home, the same path as your.bashrc
or.zshrc
#!/bin/bash
cursor_app_path=/home/<USER>/Applications
cursor_app_name=cursor_ceb0b7d8edd1edeb6fdff61b2cdde19e.AppImage
cursor_complete_app_path=$cursor_app_path/$cursor_app_name
code() {
file_or_folder_path=$1
if [ -d "$file_or_folder_path" ] || [ -f "$file_or_folder_path" ]; then
$cursor_complete_app_path $file_or_folder_path </dev/null &>/dev/null &
else
echo -e "\e[1;31m\u26A0 ERROR: Invalid path. Please provide a valid file or directory path.\e[0m"
fi
}
a. change
<USER>
with your user b. make you sure if your cursor appimage is installed by default in the same directory, for example, in my case I use appimagelauncher for setup my Appimages and by default this store my Appimages inside/home/<USER>/Applications
. c. Finally, check if yourcursor_app_name
is correct, just callingls /home/<USER>/Applications
and compare with the script above.
- set a executation permission for this file with this command:
sudo chmod +x ~/cursor.sh
- finally, import this script in your default bash with the code bellow:
echo '. "$HOME/cursor.sh"' >> ~/.bashrc # if your default shell is bash
...
echo '. "$HOME/cursor.sh"' >> ~/.zshrc # if your default shell is zsh
if you make this like i'm, the final result is a new method inside your terminal called code that you use for open code for a folder or file!
I hope this can help! :smile:
Hello @alessio-vivaldelli and @jakobFNF, @viniciusborgeis
Inspired by your discussion, I've created an advanced script for Cursor AppImage, incorporating some of the command-line options familiar to users of Visual Studio Code.
Key features of this script include:
-
Handling Non-Existent Paths: Unlike the original script, this version can open non-existent files or directories, which might be useful in certain scenarios.
-
Diverse Option Support: Supports file comparison (
-d
), adding directories (-a
), jumping to specific locations (-g
), open a new window (-n
) and reuse an existing one (-r
). However, some options such as--help
and--version
do not seem to work with the Linux AppImage, as tested oncursor-0.15.5-build-231115a5mv63u9f.AppImage
. I didn't tested all options yet. (cf. The Visual Studio Code command-line interface)
code() {
run_app() {
/opt/cursor.appimage "$@" </dev/null &>/dev/null &
}
case "$1" in
-d|--diff)
run_app --diff "$2" "$3"
;;
-a|--add)
run_app --add "$2"
;;
-g|--goto)
run_app --goto "$2"
;;
-n|--new-window)
run_app --new-window
;;
-r|--reuse-window)
run_app --reuse-window
;;
-w|--wait)
run_app --wait
;;
--locale)
run_app --locale "$2"
;;
--user-data-dir)
run_app --user-data-dir "$2"
;;
*)
if [ -z "$1" ]; then
run_app
else
run_app "$@"
fi
;;
esac
}
Best regards and happy coding! 😄
another reference, create shortcut to desktop
- chmod u+x filename.AppImage
- sudo mv filename.AppImage /opt/
- sudo mv cursor.png /opt/
- sudo nano /usr/share/applications/Cursor.desktop
- input code below [Desktop Entry] Name=Cursor Exec=/opt/cursor-0.32.2-build-240417ab4wag7sx-x86_64.AppImage Icon=/opt/cursor.png comment=IDE Type=Application Terminal=false Encoding=UTF-8 Categories=Utility;
the icon of Cursor download here
@kasi-x, I modified your script to work with Fish shell. Might come in useful for someone.
function code
function run_app
/opt/cursor.appimage $argv </dev/null &>/dev/null &
end
switch $argv[1]
case -d --diff
run_app --diff $argv[2] $argv[3]
case -a --add
run_app --add $argv[2]
case -g --goto
run_app --goto $argv[2]
case -n --new-window
run_app --new-window
case -r --reuse-window
run_app --reuse-window
case -w --wait
run_app --wait
case --locale
run_app --locale $argv[2]
case --user-data-dir
run_app --user-data-dir $argv[2]
case '*'
if test (count $argv) -eq 0
run_app
else
run_app $argv
end
end
end
I'm very frustrated how to install cursor editor on ubuntu 24.04
I have done @itsnull12 suggested, but how do i use "cursor" command in the terminal?
Thanks for sharing your experience all.
I'm very frustrated how to install cursor editor on ubuntu 24.04 I have done @itsnull12 suggested, but how do i use "cursor" command in the terminal? Thanks for sharing your experience all.
I followed this page and finally for terminal access used this:
sudo ln -s /opt/cursor.appimage /usr/local/bin/cursor
but I don't like that it does need to keep terminal open.
if you want to make the cursor command to work;
Rename cursor downloaded image to cursor.AppImage (I'm assuming it is on Downloads if you're using ubuntu)
if you use zsh > nano ~/.zshrc
if you use bash > nano ~/.bashrc
go to the end of the file and add (change youruser to your user)
alias cursor='/home/youruser/Downloads/cursor.AppImage'
then reload your edited terminal file
source ~/.bashrc
or source ~/.zshrc
if you want a different way to open, just change the alias name;
if you open / close the terminal or restart the computer it will work.
cursor() {
/opt/Cursor.AppImage "$@"
}
assuming you have the appimage in /opt/
that should work. add it to your .zsh_functions or .bash_functions file and source it or else just put it in .bashrc or .zshrc and it will behave just like code
alias
Please refer to my previous comment on this thread. I believe it answers your question.
Hello @ale99viv and @jakobFNF, @viniciusborgeis
Inspired by your discussion, I've created an advanced script for Cursor AppImage, incorporating some of the command-line options familiar to users of Visual Studio Code.
Key features of this script include:
- Handling Non-Existent Paths: Unlike the original script, this version can open non-existent files or directories, which might be useful in certain scenarios.
- Diverse Option Support: Supports file comparison (
-d
), adding directories (-a
), jumping to specific locations (-g
), open a new window (-n
) and reuse an existing one (-r
). However, some options such as--help
and--version
do not seem to work with the Linux AppImage, as tested oncursor-0.15.5-build-231115a5mv63u9f.AppImage
. I didn't tested all options yet. (cf. The Visual Studio Code command-line interface)code() { run_app() { /opt/cursor.appimage "$@" </dev/null &>/dev/null & } case "$1" in -d|--diff) run_app --diff "$2" "$3" ;; -a|--add) run_app --add "$2" ;; -g|--goto) run_app --goto "$2" ;; -n|--new-window) run_app --new-window ;; -r|--reuse-window) run_app --reuse-window ;; -w|--wait) run_app --wait ;; --locale) run_app --locale "$2" ;; --user-data-dir) run_app --user-data-dir "$2" ;; *) if [ -z "$1" ]; then run_app else run_app "$@" fi ;; esac }
Best regards and happy coding! 😄
Do they read the issues on GitHub? I think they don't.