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.
How do i create a basic script file. I want to be able to click on an icon on the desktop and be able to run a few linux commands from within the prompt.. Kinda like a BATCH file..
Any ideas? I'm sure its easy... when you know how.
How do i create a basic script file. I want to be able to click on an icon on the desktop and be able to run a few linux commands from within the prompt.. Kinda like a BATCH file..
Any ideas? I'm sure its easy... when you know how.
There are two parts to the answer. The first is about writing the script which you can test from the command line.
Once that's working the second part is how to create an icon on the desktop that will open a terminal, run the script and leave the terminal open (assuming you want to see the ouput from the script). This second part is harder and the specifics depend on which Desktop, which Terminal Emulator and which scripting language you are using. Which are you using? There are many scripting languages; the "obvious" choice is bash.
There are two parts to the answer. The first is about writing the script which you can test from the command line.
Once that's working the second part is how to create an icon on the desktop that will open a terminal, run the script and leave the terminal open (assuming you want to see the ouput from the script). This second part is harder and the specifics depend on which Desktop, which Terminal Emulator and which scripting language you are using. Which are you using? There are many scripting languages; the "obvious" choice is bash.
Well, what I'm trying to do is run PWGEN to get creative passwords. But instead of having to open a command line, think of what to type then do it.. I might as well have thought one up! so I know that the command line "sudo pwgen -n " Works. I created a link on the desktop and wrote these instructions, however Catkin you're right the terminal window does not remain open..
learn how to set the execution permissions, and how to run it from the command line, just use xterm, gnome-terminal or whatever you prefer
after that, you can start worrying about how to create a link to it on your desktop
The tutorials above can help you with the first step, all you need is a text editor, either a graphic one or a command line text-based one, it's irrelevant as long as it can save the file as plain text.
For the second step you will want to check the man page for chmod, you can also use graphical tools. Most graphical file explorers will allow you to set the permissions of a given file.
The third step is just a matter of experimenting on your desktop to create a link to the script, most desktops show some kind of "Run on a terminal" option, which is useful for these cases. If not, it still can be done. But let's worry about that later.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.