Skip to content

Instantly share code, notes, and snippets.

@zevolution
Created January 19, 2024 15:11
Show Gist options
  • Save zevolution/41e9180ba7743664d8969bbac0ca3d2b to your computer and use it in GitHub Desktop.
Save zevolution/41e9180ba7743664d8969bbac0ca3d2b to your computer and use it in GitHub Desktop.
Shortcut to open IntelliJ in WSL2

Alias to Open IntelliJ in WSL2

Firstly you need make sure that the your IntelliJ folder is in the correct path, if you doesn't already have IntelliJ, you can do the download in official site: https://www.jetbrains.com/pt-br/idea/download/?section=linux

Or you can try use the following command:

# Sometimes you can have some problems with your network connection or proxies, so try change de begin for curl -k ...
curl https://download-cdn.jetbrains.com/idea/ideaIC-2023.2.4.tar.gz --output ./intelliJ.tar.gz

Extract and move the folder to opt WSL folder with the following commands:

Important

Pay attention to the names of the folders, this may change depending on the version you download

tar -xvzf intelliJ.tar.gz
sudo mv idea-IC-232.10203.10

After this just put the following command in ~/.bashrc or ~/.zshrc

alias idea='/opt/idea-IC-232.10203.10/bin/./idea.sh "$1" > /dev/null 2>&1 &'

Tip

Usually after change something inside ~/.bashrc or ~/.zshrc, we need close the tab or all terminal to commit this changes, but you can try use the following command before do this alternatives: source ~/.bashrc or source ~/.zshrc

Now you can run the following command inside project folder:

cd some-project-folder/
idea .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment