I want to open Terminator in a specific directory, for example /home/downloads/, and then run a command.

I did the first part by this "custom command": cd /home/downloads; bash Terminator now starts in this directory, but how I can do the second part?

Now that terminator was started in the downloads directory, I want to run any command I want, for example ls or rake command or use some aliases as commands. How can I do this?

I press right mouse button in terminator and choose Parameters, then Layouts, then i add text in Custom command section.

All these must be carried out automatically after the terminator start.

  • What command do you want to run? Just run it. Do you want this to happen automatically every time you open terminator? Please edit your question and i) clarify what you want to do and ii) tell us exactly how you set up this "custom command", was it in terminator's options?
    – terdon
    Sep 30 '15 at 12:49
  • Yes i want that first and then second command run automatically after i terminator run, but now i know only how to run first command and it's worked, but don't know how then run second command. First command is: "cd" to any catalog and second command must be any i want, in this catalog or not. I edit my question. Sorry for my ugly language.
    – Asq
    Sep 30 '15 at 13:05

Run cd /home/downloads; exec bash as the custom command. (The exec builtin ensures that bash will be a child of the terminal emulator; without it, it might end up being a grandchild.) You can run terminator -e 'cd /home/downloads; exec bash' on the command line.

You can't use aliases in the custom command because your aliases are defined by ~/.bashrc, but that file is only loaded by interactive shells, not by the scripting shell that's used as a glue here between the terminal emulator and the scripting shell. If you want to use aliases, you need to load them explicitly. If you keep them in a separate file, that would be something like

. ~/.bash_aliases; cd /home/downloads; exec bash

or on the command line

terminator -x bash -c '. ~/.bash_aliases; cd /home/downloads; exec bash'

If your aliases are in ~/.bashrc, then use . ~/.bashrc, but beware that there might be things in your .bashrc that cause errors because the shell isn't interactive. If this happens, the easiest solution is to split your aliases (and functions and any other setting that you want to use in the glue code) into a separate file and use . to include those from .bashrc.


I had the same problem for activating virtual environments with Terminator.

The trick is to do everything with just "one" command: bash. Taking advantage of its -i option (interactive) and using a custom --rcfile in which PROMPT_COMMAND is set to whatever we want to execute. The result would be like this:

command = "bash --rcfile <(cat ${HOME}/.bashrc; echo 'export PROMPT_COMMAND="your commands; go here; unset PROMPT_COMMAND"') -i"

Simply replace your commands; go here; with your actual commands. See this answer for an explanation.

  • Any idea why the command I specify can't be quit with ctrl+c?
    – Flowkap
    Nov 15 '19 at 8:27

Just add the other command the same way you added the first one. For example, to run ls:

cd /home/downloads; ls; bash

You can add this to your profile's "command" option:

enter image description here

The reason that you don't get rake is that it is not in the default path. To use it, you need to specify the path. So, first run this command in your terminal:

type rake

That will return something like /foo/bin/rake. That is the path you need. Take it and add it to the Custom command above:

cd /home/downloads; /foo/bin/rake; bash

This won't work for aliases. Aliases are set up by your shell and won't be available here. A workaround is to use scripts instead. So, if you have an alias like this:

alias foo="command1 argument2"

Make a script, call it foo.sh and save it in /home/youruser/bin, with these contents:

#!/usr/bin/env bash
command1 argument2

And make it executable:

chmod a+x /home/username/bin/foo.sh

Then, in the "Custom command" section, use :

cd /home/downloads; /home/username/bin/foo.sh; bash
  • Yes i know this and "ls" command work, but 1. for example "rake" command doesn't work and terminal show error: "/bin/bash: rake: command not found" 2. I have some aliases, and for example "cd /home/downloads; 'aliasname'; bash" also doesn't work, terminal show the same error
    – Asq
    Sep 30 '15 at 13:35
  • @Asq well, yes, that's why I asked you to tell us what command you want to run. Please edit your question and give specific examples. Aliases won't work, you can forget about that, but rake should if you use the full path /path/to/rake.
    – terdon
    Sep 30 '15 at 13:42
  • I must edit my main question? And what u mean " if you use the full path /path/to/rake"? I cd to the directory where i always use rake and it's work, but "cd /path/to/rake; rake; bash" doesn't work
    – Asq
    Sep 30 '15 at 13:44
  • @Asq yes, please edit your original question. Don't do cd /path/to/rake; rake; bash do /path/to/rake; rake; bash.
    – terdon
    Sep 30 '15 at 14:03
  • :( i use rake command when i in /home/123 directory. I add now in custom command this: "/home/123; rake; bash" but console show me 2 errors: 1. /bin/bash: /home/123: This is a catalog 2. /bin/bash: rake: command not found
    – Asq
    Sep 30 '15 at 14:28

If you right click on an open Terminator window, you can choose "Preferences." Chose the "Profile" and from there, the "Command" tab. There is a check box titled "Run a custom command instead of my shell."

I believe that is what you are looking for.


Just don't use 'command =' to change directory. Use it for your actual command!

When editing .config/terminator/config, just specify

  • 'directory = <dir>' when you want terminal to automatically cd into one given dir, or
  • 'command = <cmd>; <your_shell>' when you want a custom command to execute, and not simply to change directory

For example:

  • If you only want the terminal to cd into <dir> at startup, then specify 'directory' and leave 'command' empty:

    directory = /home/dan/src/wmc
    order = 1
    parent = child3
    profile = default
    type = Terminal
    uuid = ebbe5595-06be-43ff-b7ce-4534aa6bb7f8
  • If you only want to execute a custom command, only specify command:

    command = /home/dan/mine/my-custom-command
    order = 1
    parent = child3
    profile = default
    type = Terminal
    uuid = ebbe5595-06be-43ff-b7ce-4534aa6bb7f8
  • If you want both to cd into DIR and execute command:

    directory = /home/dan/dl-dir
    command = /home/dan/mine/my-custom-command-to-run-in-dlDIR
    order = 1
    parent = child3
    profile = default
    type = Terminal
    uuid = ebbe5595-06be-43ff-b7ce-4534aa6bb7f8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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