Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu in VirtualBox on Mac. As I switch frequently, I would like to use the same shortcuts. Please, does anyone know how to have the same shortcuts on Ubuntu, as they are on Mac? Specifically, I would like to Copy, Paste, Select All, ... work with Cmd+C, Cmd+V, Cmd+A, ... (even in terminal - no Ctrl+Shift, just Ctrl).

I tried to change Keyboard Layout to Apple Laptop, but that didn't help.

share|improve this question
Is the Cmd key the alternative to Ctrl or Alt? – Seth Nov 22 '13 at 1:02
If I remember correctly, Cmd is equal to ctrl. – Kaz Wolfe Nov 22 '13 at 14:47

There's no need to use xbindkeys to achieve OSX-like keyboard mapping on Ubuntu. This is an inbuilt option:

  1. Go into your Ubuntu Settings
  2. Navigate to KeyboardKeyboard Layout Settings
  3. add English (Macintosh)
share|improve this answer
I do not see Keyboard Layout Settings on Ubuntu 14.0.4 – chovy Sep 22 '14 at 8:04
This does not work on VirtualBox. All i got was a shrunken window when I tried copy/paste. – chovy Dec 27 '14 at 7:22
lol, after so much time trying all the other solutions out there, this one is so easy and worked immediately. (Ubuntu 14.04.3 LTS 64bit in VirtualBox 5.0.4). Thanks – Allisone Sep 12 '15 at 12:59
This doesn't work for me, on virtualbox. – Peter Brooks Feb 22 at 9:33
This doesn't work at all, bro. – Arnold Mar 14 at 1:27

couldn't you add custom shortcuts?? If that wasn't possible or didn't work you might want to change the keybindings of your vmbox. You'll need to do the following:

Install xbindkeys

sudo apt-get install xbindkeys

Xbindkeys is a very versatile program that lets you remap keys very easily. It uses a config file, my default located in your home directory, to change key bindings into certain commands.

To create a default config file you use the command:

xbindkeys --defaults

Which prints the default config file. So if you want to create the file containing the default values you would use:

xbindkeys --defaults > $HOME/.xbindkeysrc

Which prints the default values into a hidden file named .xbindkeysrc located in home.

Now to actually change the bindings of keys we first need to know what the name or keysym of those keys is. xbindkeys allows us to use the -k handle to find the name of a key or key combination. Run:

xbindkeys -k

Now press ctrl (of cmd) and check the output

Try pressing ctrl + c (after disabling that shortcut in the terminal using the second part of this explination)

It will tell you the name of the key/key combination.

Now we need to tell linux to call upon cmd when ctrl is pressed.

for this we will need an extra piece of software as xbindkeys does not support this on it's own. I know of two programs which we can use, xdotool and xte. I prefer xte so I'm going to use that.

Install it:

sudo apt-get install xautomation

( To call a single key press: xte 'key keyName'

To call a key combination: xte 'keydown keyName' 'keydown secondKeyName' 'keyup keyName' 'keyup secondKeyName

For more info you can read the manual man xte )

Lets open up the config file you made earlier: (the one you made using xbindkeys --defaults > $HOME/.xbindkeysrc)

gedit .xbindkeysrc

You'll get something like this:

# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
# List of modifier:
#   Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#   Mod3 (CapsLock), Mod4, Mod5 (Scroll). 

# The release modifier is not a standard X modifier, but you can  
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers
# NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.

#keystate_numlock = enable
#keystate_capslock = enable
#keystate_scrolllock= enable

# Examples of commands:

Earlier you extracted the key/key combination. now that you know the command for simulating key presses you can call it from your xbindkeys script, like this:

"xte 'ctrl'" Cmd (or something like this depended upon the name given to you by xbindkeys)

Add this to you're xbindkeys script and save it.

You'll notice that it doesn't work (yet). That's because xbindkeys isn't running yet. start it with the following command.


Your commands should work now. If it doesn't work you might wanna try adding commands to your key-combinations like copy and paste. If that doesn't work either there is an alternative but that's quite a lot of writing. You could also try xmodmap or xkeycaps.

I would like to note that xbindkeys and xte don't always work well together.

As for your terminal shortcuts: You can change them ALL by opening your terminal and clicking edit in the top bar. Then click keyboard shortcuts and change the value of copy and paste under the header "edit" into ctrl (or in your case cmd) + c and ctrl + v

share|improve this answer
these are solutions to fix your problem INSIDE the vmbox. You might be able to exchange certain keyscodes by setting up a keycode exchange table in your vmbox but I don't have any experience with vmboxes – Arno van der Weijden Nov 24 '13 at 1:36

That will depend on the software you are using to run your virtual machine. For exemple, I use VMWare Fusion to run Ubuntu on my Mac and to achieve what you want, I went to "Settings" of VMWare Fusion and setup the key-mapping I wanted inside that specific virtual machine (I can have multiple setups, one for each VM).

I never used VirtualBox, but I'm pretty sure you can do that in the Settings of VirtualBox.

share|improve this answer

I'm still running Ubuntu 12.04 for various reasons, so I can't speak for later iterations, but try this:

Okay, firstly, you might want to set your VB host key to something specific such as the right command or right alt key...something you don't use normally. I think the default is the left command key, which is going to interfere with most people's operations.

This can be done in the preferences for VirtualBox itself (rather than inside the guest machine or as any machine-specific setting). With the VB app open (not the VM window), choose VirtualBox->Preferences->Input, then select the host key at the head of the "Virtual Machine" field/mapping list.

Okay, after that, inside the Ubuntu guest machine itself:

  1. Open your system settings, and choose Keyboard Layout.
  2. Open the Layouts tab.
  3. You'll probably have only one entry - English (US) or somesuch. Highlight this and click the "Options" button in the lower right.
  4. Open up the "Alt/Win Key Behaviour" expander.
  5. Choose "Control is mapped to Win keys (and the usual Ctrl keys)".

You should find that your Mac command key now works as desired for command-C, command-V etc.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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