LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2018, 08:37 AM   #1
Astral Axiom
Member
 
Registered: Feb 2018
Location: Asheville, NC
Distribution: Ubuntu, Arch, Centos, Debian, Kali
Posts: 47

Rep: Reputation: Disabled
Using the ln command to open or create and open file.py in kate


I recently installed Sublime-text on KDE Neon because my online Python instructor uses it and I have enjoyed it. Now they want me to pay $80 for a license and I am switching back to Kate. My instructor shared an "ln" command to create a symlink that will open or create and open a file in Sublime with the command:
Code:
subl path/to/file.py
the command to create the symlink is:
Code:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
I am looking in the man pages for "ln" and I am not sure which form of the command he is using(1st, 2nd, 3rd, or 4th), also I just do not fully understand what the command does other than it creates a symbolic link and the target is
Code:
/usr/local/bin/sublime
can anyone help me develop a command to do this for Kate text editor?

Thanks so much for all the help and support that I get on this forum I will be able to help too soon, as I am taking some Linux courses along with my coding courses on Udemy.

I am also wanting to do this in Arch linux on my laptop. The same command worked on both systems for Sublime. It should as well for Kate right?
 
Old 04-12-2018, 09:10 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Astral Axiom View Post
I recently installed Sublime-text on KDE Neon because my online Python instructor uses it and I have enjoyed it. Now they want me to pay $80 for a license and I am switching back to Kate. My instructor shared an "ln" command to create a symlink that will open or create and open a file in Sublime with the command:
Code:
subl path/to/file.py
the command to create the symlink is:
Code:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
I am looking in the man pages for "ln" and I am not sure which form of the command he is using(1st, 2nd, 3rd, or 4th), also I just do not fully understand what the command does other than it creates a symbolic link and the target is
Code:
/usr/local/bin/sublime
can anyone help me develop a command to do this for Kate text editor?

Thanks so much for all the help and support that I get on this forum I will be able to help too soon, as I am taking some Linux courses along with my coding courses on Udemy. I am also wanting to do this in Arch linux on my laptop. The same command worked on both systems for Sublime. It should as well for Kate right?
The syntax for ln is
Code:
ln -s <thing you want to link to> <link location>
But you don't need to create a shortcut for kate, since it's already a KDE application. Typing in "kate <filename>" should bring it up, but why? Right-click it in file explorer, and open with kate. Click File->Open in Kate, and select the file. Not sure what you're trying to accomplish with a short-cut.

But bear in mind there are MANY great IDE's out there, and Kate isn't particularly good for code deveopment. Investigate KDevelop, Anjuta, or Eclipse, since they are designed specifically for code editing, including
 
Old 04-12-2018, 11:38 AM   #3
Astral Axiom
Member
 
Registered: Feb 2018
Location: Asheville, NC
Distribution: Ubuntu, Arch, Centos, Debian, Kali
Posts: 47

Original Poster
Rep: Reputation: Disabled
Thanks so much I see what you mean, but I am using Kate because I am learning Python and want to do so in a text editor not an IDE that does everything for me. I have PyCharm too and was using it when I started with Python. I just want a less automated experience for the learning process and I will use an IDE later.

The purpose of the symlink is so that I can create and open or just open a file in Kate with one command from the terminal (where I will be running the programs I create) instead of clicking through several steps Kate's GUI to achieve the same goal. Also, just to learn and have the experience of creating symlinks in general.

So in the link for sublime there are two locations inside the quotation marks, does that mean I am linking those two locations and the link is located at the location outside the quotes? i.e. am I linking:
Code:
/Applications/Sublime
to:
Code:
Text.app/Contents/SharedSupport/bin/subl
and storing that link at:
Code:
/usr/local/bin/sublime
?

If so, how does that cause a file to open in Sublime when I type
Code:
subl file.py
? I do not have a directory called Applications and definitely not one called Text.app:
Code:
$ ls /Applications
ls: cannot access '/Applications': No such file or directory
$ ls Text.app
ls: cannot access 'Text.app': No such file or directory
 
Old 04-12-2018, 11:56 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Astral Axiom View Post
Thanks so much I see what you mean, but I am using Kate because I am learning Python and want to do so in a text editor not an IDE that does everything for me. I have PyCharm too and was using it when I started with Python. I just want a less automated experience for the learning process and I will use an IDE later.
Understand, but I have to disagree. IDE's don't 'do everything for you', and won't write your code for you. What they DO offer is a way to fix/notice common mistakes, like mismatched braces, etc., that are easy to do, and hard to spot. Making your life more difficult isn't a good way to learn. Also, IDE's hook in with SVN, GIT, and other such repositories, along with letting you do actual debugging.

Taking more time isn't necessarily a good thing, in this case.
Quote:
The purpose of the symlink is so that I can create and open or just open a file in Kate with one command from the terminal (where I will be running the programs I create) instead of clicking through several steps Kate's GUI to achieve the same goal. Also, just to learn and have the experience of creating symlinks in general.
Right...so back to "just type in kate <filename>" and press enter. Done.
Quote:
So in the link for sublime there are two locations inside the quotation marks, does that mean I am linking those two locations and the link is located at the location outside the quotes? i.e. am I linking:
Code:
/Applications/Sublime
to:
Code:
Text.app/Contents/SharedSupport/bin/subl
and storing that link at:
Code:
/usr/local/bin/sublime
?
No...the location is in quotes because there is a space in it. If there wasn't, you could just have:
"ln -s /Applications/SublimeText.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime"

..and it would work fine.
Quote:
If so, how does that cause a file to open in Sublime when I type
Code:
subl file.py
? I do not have a directory called Applications and definitely not one called Text.app:
Code:
$ ls /Applications
ls: cannot access '/Applications': No such file or directory
$ ls Text.app
ls: cannot access 'Text.app': No such file or directory
Where your instructor has things on their system may be different than yours. Modify the ln statement accordingly. But again, there is **NO NEED** to do this, and using kate for programming is **NOT** a good way to learn. If you want to program in a professional environment, learning how to do things professionally would be a better place to start.
 
Old 04-12-2018, 01:55 PM   #5
Astral Axiom
Member
 
Registered: Feb 2018
Location: Asheville, NC
Distribution: Ubuntu, Arch, Centos, Debian, Kali
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Understand, but I have to disagree. IDE's don't 'do everything for you', and won't write your code for you. What they DO offer is a way to fix/notice common mistakes, like mismatched braces, etc., that are easy to do, and hard to spot. Making your life more difficult isn't a good way to learn. Also, IDE's hook in with SVN, GIT, and other such repositories, along with letting you do actual debugging.

Taking more time isn't necessarily a good thing, in this case.
Ok, thanks for that I am just following the instructors methods for now, once we get into the object oriented sections and actually create classes and instances of classes I am sure he will switch to an IDE. I only know about OOP because I have gone through a Java course in NetBeans that was actually through my college, I am just doing this outside school to get ahead. If I had started at the university instead of transferring in from the community college I would have learned Python first, but I was unaware of the best sequence to learn languages at the time.
Quote:
Right...so back to "just type in kate <filename>" and press enter. Done.
I have done it this way and it keeps the terminal open and busy, I suppose I could open another instance of terminal and use it to test code that I am writing. The symlink method does not keep the terminal open and busy.

Quote:
No...the location is in quotes because there is a space in it. If there wasn't, you could just have:
"ln -s /Applications/SublimeText.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime"

..and it would work fine.
Ok, I see that now. So knowing that It is unnecessary to do this, but still wanting to understand symlinks; how would I translate the part in quotes to use for Kate? The part outside the quotes is just the location of Sublime's configuration files and such I think, right? Is the part inside the quotes a path that Sublime uses internally to open files if you click through the GUI to do so? How is the target("thing to link to") determined? Where do I look to find this path?
Quote:
Where your instructor has things on their system may be different than yours. Modify the ln statement accordingly. But again, there is **NO NEED** to do this, and using kate for programming is **NOT** a good way to learn. If you want to program in a professional environment, learning how to do things professionally would be a better place to start.
His exact command worked on my system since
Code:
/usr/bin
is in my $PATH. I only say that because his instruction to do this said to be sure that it is or it will not work. So I am thinking that the path in quotes is something that is default in Sublime.

Sorry to drum on about this, at this point it is less about making this work for Kate and more about gaining understanding of creating symlinks in general.

Thanks so much

Last edited by Astral Axiom; 04-12-2018 at 01:58 PM.
 
Old 04-12-2018, 02:09 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Astral Axiom View Post
Ok, thanks for that I am just following the instructors methods for now, once we get into the object oriented sections and actually create classes and instances of classes I am sure he will switch to an IDE. I only know about OOP because I have gone through a Java course in NetBeans that was actually through my college, I am just doing this outside school to get ahead. If I had started at the university instead of transferring in from the community college I would have learned Python first, but I was unaware of the best sequence to learn languages at the time.
Nothing to do with OOP, but EVERYTHING to do with learning correctly and efficiently. Would you rather spend time on learning the language(s), or trying to hunt down a missing semi-colon, or mismatched brace?
Quote:
I have done it this way and it keeps the terminal open and busy, I suppose I could open another instance of terminal and use it to test code that I am writing. The symlink method does not keep the terminal open and busy.
Sorry, no....a symlink isn't special, it's just a pointer to a file. No matter what it links to, it'll keep the terminal busy until the process forks or ends. Sublime *MAY* background itself, but you can do that with "kate <filename> &", and your terminal will be free. But again, doing as you are is a bad practice to get into, since it is **NOT** a typically done thing, and is far less efficient than starting a project, or clicking File->Open Recent in an IDE. Again, IDE's were written to do this...you can store a SESSION, which may include a dozen source-files, and have them open with a single click.
Quote:
Ok, I see that now. So knowing that It is unnecessary to do this, but still wanting to understand symlinks; how would I translate the part in quotes to use for Kate? The part outside the quotes is just the location of Sublime's configuration files and such I think, right? Is the part inside the quotes a path that Sublime uses internally to open files if you click through the GUI to do so? How is the target("thing to link to") determined? Where do I look to find this path?
The "thing to link to" is the original location. That is determined by where things are, simply enough. If you copy a file into /usr/bin, that's where it is. Move it somewhere else, then THAT'S where it is.
Quote:
His exact command worked on my system since
Code:
/usr/bin
is in my $PATH. I only say that because his instruction to do this said to be sure that it is or it will not work. So I am thinking that the path in quotes is something that is default in Sublime.
Perhaps, but again, you don't have the base directory. Again, stop where you are and do things correctly. Use any of the IDE's that are available to you, and not one you have to pay for.
Quote:
Sorry to drum on about this, at this point it is less about making this work for Kate and more about gaining understanding of creating symlinks in general.
Again, symlinks are pointers, that's all. The file is in ONE location, like /usr/bin/file. You can LINK to it in several places, like /usr/local/bin/file, /sbin/file, etc., etc., etc. That's it. Nothing magic.
 
Old 04-13-2018, 08:27 PM   #7
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
The symlink in the op is unusual. I personally do not understand it. It looks like it might a capability unique to sublime. And I agree that kate, nor any other pure text editor is a good programming tool. I can just imagine writing guis with one! I suggest the op either ask the teacher about that symlink, or just forget about it, because it isn't a typical example.

Last edited by AwesomeMachine; 04-13-2018 at 08:30 PM.
 
1 members found this post helpful.
  


Reply

Tags
kate, symlinks



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open two instancies of kate in one desktop ostene Linux - Software 3 06-30-2015 07:28 PM
Suddenly can't open Kate anymore Red Squirrel Linux - Software 4 02-02-2015 08:05 PM
[SOLVED] Kate 3.8.5. how to toggling between two open files lylehsaxon Linux - Software 2 09-23-2012 05:47 AM
how to know a file was open/create for writting risking Programming 3 04-23-2010 08:01 PM
Is it possible to create autorun for CD..open a html file... niroperera Linux - General 3 09-01-2008 04:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration