[SOLVED] Using the ln command to open or create and open file.py in kate
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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?
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:
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
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
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.
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.
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.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.