TAB for indentation in Gnome terminals


How to enable TAB button to indent in Gnome terminals? Very useful to have TAB button for indentation (with 4 spaces) in Gnome terminal for Python.

Thank you.

To write code (python or otherwise), you have to first launch a text editor.
If you launch vim for instance, you should find that TAB works as you expect.

In other words, the functionality you’re looking for shouldn’t have any relationship with the terminal you’re using (Gnome or otherwise), or if you think you should be able to do it, post what you’re trying to do… It’s likely that your code is being re-directed to something(like a HereDoc) before it can execute if it’s more than one line (where you would have use to format).


I’m just typing python in the terminal to get Python interpreter. In defining functions, cannot use TAB button to make indentation, and instead i have to use SPACE to make indentation.

I would like to use TAB button for indentation with four spaces instead of SPACE bar with one space for indentation.

What TSU already tried to explain is that the interpretation of a TAB character typed is done by the program running. This is not Gnome, it is not the Gnome terminal, but as long as you type bash commands it is bash. Now you seem to have started the Python interpreter, thus it is the Python interpreter that should do something with your TAB character (and you want to echo it with up to four space characters to a Tabbing point when I understand you correct). Thus you have to find out if Python supports this and when yes, how to set it.

I am not a Python user, thus I do not know the answer, but I got the strong impression that you were looking in the wrong place (the terminal emulator program).

Please use an editor, A terminal window is not fot writing python code. Write the script in a file the run it the ‘python’. Inside you can use indentation,

In Ubuntu Unity desktop, the TAB button used to work fine as a four-space indentation in Gnome terminal itself for bash commands and also in Python interpreter. In the pure Gnome desktop, the TAB button does not react .

I am using Python interpreter for testing out small chunks of code, playing around with the code. Very easy and convenient to play with the code straight from Python interpreter.

Sure i use an editor for scripts saving them in the .py files. But to quickly test one line statements or a few lines of code with the Python interpreter in the terminal is really convenient.

You will need to modify your Python shell – the one the “>>>” prompt.

The Bash shell by default uses the tab-key for its tab-completion feature. If you install the Dash shell (zypper in dash), type “dash” at the Bash prompt (>), and then press <tab> or <ctl+i> at the Dash prompt ($) white-space equivalent to six spaces is insertd. If you enter the Python shell from Dash, the tab-key function is lost until you exit back to the Dash shell.

Thanks guys for the hints.

Found the solution: