-2

This question already has an answer here:

For instance if I wanted to type

$Ctrl+Alt+Delete

and it would return the same as

$reboot

this way when editing custom taskbar launchers we can execute key commands via terminal. Would I write a bash script or is there an editable script where commands such as reboot live? Sorry if this was over your head those of you who down voted for no reason rather than answering.

marked as duplicate by Eliah Kagan, Eric Carvalho, Jacob Vlijm, Seth Oct 21 '14 at 22:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Your question is very unclear. Do you actually want to type that into the command line (as your question indicates since you have added the $ prompt) or do you want to make those keys a shortcut for a specific command? The two are completely different. – terdon Oct 17 '14 at 12:24
  • I dont know how to be more clear I want to type LCtrl+LAlt+Delete into a launchers terminal field. I want written keyboard shortcuts to work in terminal to make touchable buttons that perform keyboard shortcuts via terminal. – user2218260 Oct 17 '14 at 22:02
  • xdotool gave me the functionality necessary to carry out key stroke via command line...this should not require an application written keystrokes should be a stock functionality of terminal to make ubuntu more touch friendly. – user2218260 Oct 18 '14 at 17:20
1

Well, you could type the following commands. When typing, make CUSTOMCOMMAND what you want the command to be when you type it in the terminal.sudo su, cd /usr/bin, nano CUSTOMCOMMAND. Then, write #!/bin/bash and make a little script of what yo want to happen when you run your command. Then press Ctrl+X when done, answer y, press Enter, and chmod +x CUSTOMCOMMAND. That command should now work, no reboot should be needed. The command might only work for root. You'll have to change the file permissions to fix that.

  • But isn't there already a bash script somewhere that contains mundane commands like (reboot)? – user2218260 Oct 17 '14 at 4:13
  • It seems a little bit disorganized for an OS to not have a manifest of basic commands. – user2218260 Oct 17 '14 at 5:08
  • I mean even in low level programming there are auto generated files that the basic command structure references to/from. – user2218260 Oct 17 '14 at 5:11
  • 1
    @user2218260 you're not very clear about what you want. Define "basic", for example. What auto-generated files are you talking of? – muru Oct 17 '14 at 5:36
  • Ok for instance there should be terminal commands for every window action such as minimize, maximize, exit, and show desktop I'm trying to make menu bar buttons that do the same functions as keyboard shorcuts ie. making ubuntu more touch friendly less buttin mashing on the keyboard see attached image of Android like buttons that perform window operations. – user2218260 Oct 17 '14 at 21:49
1

You can add custom Bash commands in your bash profile. From terminal:

echo "custom_command(){ userdir=$(cd ~ && pwd); echo $userdir; }" >> ~/.bash_profile
source ~/.bash_profile

Then try it out from terminal:

custom_command

Not the answer you're looking for? Browse other questions tagged or ask your own question.