Hack Forums
[Help] Linux command shortcut [linux] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Help] Linux command shortcut [linux] (/showthread.php?tid=5718755)



Linux command shortcut [linux] - Mr. Noodle™ - Sep 16, 2017

so im looking for a way i can add a shortcut to my home screen (desktop) and when clicked it will open terminal and run a command as im not good at remembering some of them.

Example: i sometimes run 'nmcli d wifi' that shows current wifis and signals. i was wondering if theres a way that i can just dobble click a shortcut on the desktop and it runs that for me ??

thanks aha, this could be simple but i personally dont know of it


* - genu - Sep 16, 2017

Code
#!/bin/bash
nmcli d wifi

Save this and run it using

Code
bash filename

You could also add an alias by editing (~/.bashrc), for example:

Code
alias wifi='nmcli d wifi'

and then just type "wifi" on the terminal.


* - Mr. Noodle™ - Sep 17, 2017

(Sep 16, 2017 03:02 PM)genu Wrote:  
Code
#!/bin/bash
nmcli d wifi

Save this and run it using

Code
bash filename
I got this and love it. set it up with a few useful commands to open programs and stuff Thanks :D


(Sep 16, 2017 03:02 PM)genu Wrote:  You could also add an alias by editing (~/.bashrc), for example:

Code
alias wifi='nmcli d wifi'

and then just type "wifi" on the terminal.

cant seem to get this one working, i opened and edit the bashrc in nano and save it, when i try to run (called with wifian as wifi is already taken by tlc) it dosent work, just returns and error. anyways i got the bash file working great