Tuesday, November 10, 2009

Create a Terminal Command in Solaris

Create a text file in your desktop.

Edit the text file with the commands that you would want it to run, as if typing on terminal.

For example you want to set the keyboard layout to dvorak, type in "xmodmap /usr/share/xmodmap/xmodmap.dvorak".

Close the file, right-click, Properties>Permissions, then check the Make file runnable option.

Go to /usr/bin/ in File Browser. (Places>System>Filesystem>usr>bin)

After that, click File>Open in Terminal.

In terminal, type in "mv /export/home/*your-user-name*/Desktop/*file-name-of-command* *command-name-you-like*"

===========END==========

Note: If you get "Permission Denied" errors in terminal, you need to use terminal as a super user. To do this, enter "su" in terminal. Then, type in your password (even if you don't see anything being typed) and hit enter. Now try the command again. =)


EXAMPLE:
I want to create a command that I could type in terminal to easily set the keyboard layout to dvorak.

I create a file in desktop, name it whatever I want like "dvoraker".

In the file, I write the xmodmap command mentioned above.

I go to /usr/bin/ and open it in Terminal.

Then in terminal, assuming my username is grapeseed, I write "mv /export/home/grapeseed/Desktop/dvoraker asdf".

Done. Now when I reboot and need to reload my dvorak layout, I just launch terminal and tap the four keys under my left hand (that's why I named the command asdf).


TIP: It's also wise to create a notification to tell you that the command successfully completed. In this example, I may write "echo 'dvorak success'" in addition to the xmodmap command.

No comments:

Post a Comment