How to resize terminal window permanently using CLI?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
Inside the terminal when I type resize -s 50 50
terminal output is changed as rows 50 and columns 50.
But after closing the window and reopen terminal doesn't reflect the changes.
I want to open the terminal all time as rows 50 and columns 50.
I know this can be done using terminal Edit->Profile Preference->General setting
with changing the rows and columns number, but I want to do this in CLI, because I have to do this inside a big script.
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '''s/^s*[0-9]+s*//;s/[;&|]s*alert$//''')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
##########################################################################################################
#alhelal customization
resize -s 50 50
#resize -s 50 50 >/dev/null
##########################################################################################################
Result after pressing CtrlAltT
The default terminal size of Ubuntu is smaller than my monitor. When I install new OS I have to change many setting(customization), installation many software. So, I am making a script that do the customization and install all stuffs without my interruption. e.g.,
- change terminal window size
- make shortkey
- install firefox addons
- install software
- clone git repository.
command-line gnome-terminal resize
add a comment |Â
up vote
1
down vote
favorite
Inside the terminal when I type resize -s 50 50
terminal output is changed as rows 50 and columns 50.
But after closing the window and reopen terminal doesn't reflect the changes.
I want to open the terminal all time as rows 50 and columns 50.
I know this can be done using terminal Edit->Profile Preference->General setting
with changing the rows and columns number, but I want to do this in CLI, because I have to do this inside a big script.
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '''s/^s*[0-9]+s*//;s/[;&|]s*alert$//''')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
##########################################################################################################
#alhelal customization
resize -s 50 50
#resize -s 50 50 >/dev/null
##########################################################################################################
Result after pressing CtrlAltT
The default terminal size of Ubuntu is smaller than my monitor. When I install new OS I have to change many setting(customization), installation many software. So, I am making a script that do the customization and install all stuffs without my interruption. e.g.,
- change terminal window size
- make shortkey
- install firefox addons
- install software
- clone git repository.
command-line gnome-terminal resize
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Inside the terminal when I type resize -s 50 50
terminal output is changed as rows 50 and columns 50.
But after closing the window and reopen terminal doesn't reflect the changes.
I want to open the terminal all time as rows 50 and columns 50.
I know this can be done using terminal Edit->Profile Preference->General setting
with changing the rows and columns number, but I want to do this in CLI, because I have to do this inside a big script.
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '''s/^s*[0-9]+s*//;s/[;&|]s*alert$//''')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
##########################################################################################################
#alhelal customization
resize -s 50 50
#resize -s 50 50 >/dev/null
##########################################################################################################
Result after pressing CtrlAltT
The default terminal size of Ubuntu is smaller than my monitor. When I install new OS I have to change many setting(customization), installation many software. So, I am making a script that do the customization and install all stuffs without my interruption. e.g.,
- change terminal window size
- make shortkey
- install firefox addons
- install software
- clone git repository.
command-line gnome-terminal resize
Inside the terminal when I type resize -s 50 50
terminal output is changed as rows 50 and columns 50.
But after closing the window and reopen terminal doesn't reflect the changes.
I want to open the terminal all time as rows 50 and columns 50.
I know this can be done using terminal Edit->Profile Preference->General setting
with changing the rows and columns number, but I want to do this in CLI, because I have to do this inside a big script.
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot:-" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='$debian_chroot:+($debian_chroot)[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='$debian_chroot:+($debian_chroot)u@h:w$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;$debian_chroot:+($debian_chroot)u@h: wa]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '''s/^s*[0-9]+s*//;s/[;&|]s*alert$//''')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
##########################################################################################################
#alhelal customization
resize -s 50 50
#resize -s 50 50 >/dev/null
##########################################################################################################
Result after pressing CtrlAltT
The default terminal size of Ubuntu is smaller than my monitor. When I install new OS I have to change many setting(customization), installation many software. So, I am making a script that do the customization and install all stuffs without my interruption. e.g.,
- change terminal window size
- make shortkey
- install firefox addons
- install software
- clone git repository.
command-line gnome-terminal resize
edited May 19 at 4:08
asked May 17 at 16:37
![](https://i.stack.imgur.com/ptbZP.png?s=32&g=1)
![](https://i.stack.imgur.com/ptbZP.png?s=32&g=1)
alhelal
5232623
5232623
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
3
down vote
First option
You can always run resize -s 50 50
at terminal launch using ~/.bashrc
file. And to hide the command output just redirect it to the /dev/null
device.
In other words, to resize the terminal using command line use:
echo "resize -s 50 50 >/dev/null" >> ~/.bashrc
Second option
After messing around with dconf-editor
I believe I found exactly what you're searching for. gnome-terminal
store its setting in dconf
instead of config files. First you have to select the currently active terminal profile running this command:
currentprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
Then to set 50 rows as default run:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-rows 50
And similarly for the columns:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-columns 50
Done. Hope this helps
I putresize -s 50 50 >/dev/null
in top of.bashrc
but doesn't affect terminal size.
â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
+1. Thanks for finding how to usegsettings
and showing a solution :-)
â sudodus
May 18 at 16:47
1
@sudodus It works for me also when I unselecteduse custom default terminal size
ibb.co/bAGMWT Thank you.
â alhelal
May 19 at 4:13
 |Â
show 6 more comments
up vote
2
down vote
gnome-terminal
If I understand correctly, you are using standard Ubuntu and gnome-terminal
, so you can use the following command line in your script,
gnome-terminal --geometry <columns>x<rows>
for example
gnome-terminal --geometry 135x45
You find the available options in man gnome-terminal
.
xterm
The corresponding command line for good old xterm
is
xterm -geometry 135x45
where you can add details to set the absolute position on the desktop (in pixels). Test these command lines,
xterm -geometry 90x25+0+0 # top left
xterm -geometry 90x25+0-0 # bottom left
xterm -geometry 90x25-0+0 # top right
xterm -geometry 90x25-0-0 # bottom right
and you can select other values than 0
for an arbitrary location.
You find the available options in man xterm
(there are a lot of options).
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
I think the OP is asking for the CLI equivalent ofEdit->Profile Preference->General settings
. Maybe somegsettings
call or something.
â PerlDuck
May 17 at 18:13
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
 |Â
show 7 more comments
up vote
0
down vote
It works for me when I unselected use custom default terminal size
Add add
resize -s 50 50 > /dev/null
to ~/.bashrc
After pressing CtrlAltT
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
First option
You can always run resize -s 50 50
at terminal launch using ~/.bashrc
file. And to hide the command output just redirect it to the /dev/null
device.
In other words, to resize the terminal using command line use:
echo "resize -s 50 50 >/dev/null" >> ~/.bashrc
Second option
After messing around with dconf-editor
I believe I found exactly what you're searching for. gnome-terminal
store its setting in dconf
instead of config files. First you have to select the currently active terminal profile running this command:
currentprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
Then to set 50 rows as default run:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-rows 50
And similarly for the columns:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-columns 50
Done. Hope this helps
I putresize -s 50 50 >/dev/null
in top of.bashrc
but doesn't affect terminal size.
â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
+1. Thanks for finding how to usegsettings
and showing a solution :-)
â sudodus
May 18 at 16:47
1
@sudodus It works for me also when I unselecteduse custom default terminal size
ibb.co/bAGMWT Thank you.
â alhelal
May 19 at 4:13
 |Â
show 6 more comments
up vote
3
down vote
First option
You can always run resize -s 50 50
at terminal launch using ~/.bashrc
file. And to hide the command output just redirect it to the /dev/null
device.
In other words, to resize the terminal using command line use:
echo "resize -s 50 50 >/dev/null" >> ~/.bashrc
Second option
After messing around with dconf-editor
I believe I found exactly what you're searching for. gnome-terminal
store its setting in dconf
instead of config files. First you have to select the currently active terminal profile running this command:
currentprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
Then to set 50 rows as default run:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-rows 50
And similarly for the columns:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-columns 50
Done. Hope this helps
I putresize -s 50 50 >/dev/null
in top of.bashrc
but doesn't affect terminal size.
â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
+1. Thanks for finding how to usegsettings
and showing a solution :-)
â sudodus
May 18 at 16:47
1
@sudodus It works for me also when I unselecteduse custom default terminal size
ibb.co/bAGMWT Thank you.
â alhelal
May 19 at 4:13
 |Â
show 6 more comments
up vote
3
down vote
up vote
3
down vote
First option
You can always run resize -s 50 50
at terminal launch using ~/.bashrc
file. And to hide the command output just redirect it to the /dev/null
device.
In other words, to resize the terminal using command line use:
echo "resize -s 50 50 >/dev/null" >> ~/.bashrc
Second option
After messing around with dconf-editor
I believe I found exactly what you're searching for. gnome-terminal
store its setting in dconf
instead of config files. First you have to select the currently active terminal profile running this command:
currentprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
Then to set 50 rows as default run:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-rows 50
And similarly for the columns:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-columns 50
Done. Hope this helps
First option
You can always run resize -s 50 50
at terminal launch using ~/.bashrc
file. And to hide the command output just redirect it to the /dev/null
device.
In other words, to resize the terminal using command line use:
echo "resize -s 50 50 >/dev/null" >> ~/.bashrc
Second option
After messing around with dconf-editor
I believe I found exactly what you're searching for. gnome-terminal
store its setting in dconf
instead of config files. First you have to select the currently active terminal profile running this command:
currentprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
Then to set 50 rows as default run:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-rows 50
And similarly for the columns:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$currentprofile:1:-1/ default-size-columns 50
Done. Hope this helps
edited May 17 at 21:33
answered May 17 at 16:58
![](https://i.stack.imgur.com/eTdFB.png?s=32&g=1)
![](https://i.stack.imgur.com/eTdFB.png?s=32&g=1)
Eskander Bejaoui
1,0141619
1,0141619
I putresize -s 50 50 >/dev/null
in top of.bashrc
but doesn't affect terminal size.
â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
+1. Thanks for finding how to usegsettings
and showing a solution :-)
â sudodus
May 18 at 16:47
1
@sudodus It works for me also when I unselecteduse custom default terminal size
ibb.co/bAGMWT Thank you.
â alhelal
May 19 at 4:13
 |Â
show 6 more comments
I putresize -s 50 50 >/dev/null
in top of.bashrc
but doesn't affect terminal size.
â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
+1. Thanks for finding how to usegsettings
and showing a solution :-)
â sudodus
May 18 at 16:47
1
@sudodus It works for me also when I unselecteduse custom default terminal size
ibb.co/bAGMWT Thank you.
â alhelal
May 19 at 4:13
I put
resize -s 50 50 >/dev/null
in top of .bashrc
but doesn't affect terminal size.â alhelal
May 17 at 17:11
I put
resize -s 50 50 >/dev/null
in top of .bashrc
but doesn't affect terminal size.â alhelal
May 17 at 17:11
it doesn't work also in last line.
â alhelal
May 17 at 17:31
it doesn't work also in last line.
â alhelal
May 17 at 17:31
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
@alhelal I updated my answer, try the second option
â Eskander Bejaoui
May 17 at 21:38
1
1
+1. Thanks for finding how to use
gsettings
and showing a solution :-)â sudodus
May 18 at 16:47
+1. Thanks for finding how to use
gsettings
and showing a solution :-)â sudodus
May 18 at 16:47
1
1
@sudodus It works for me also when I unselected
use custom default terminal size
ibb.co/bAGMWT Thank you.â alhelal
May 19 at 4:13
@sudodus It works for me also when I unselected
use custom default terminal size
ibb.co/bAGMWT Thank you.â alhelal
May 19 at 4:13
 |Â
show 6 more comments
up vote
2
down vote
gnome-terminal
If I understand correctly, you are using standard Ubuntu and gnome-terminal
, so you can use the following command line in your script,
gnome-terminal --geometry <columns>x<rows>
for example
gnome-terminal --geometry 135x45
You find the available options in man gnome-terminal
.
xterm
The corresponding command line for good old xterm
is
xterm -geometry 135x45
where you can add details to set the absolute position on the desktop (in pixels). Test these command lines,
xterm -geometry 90x25+0+0 # top left
xterm -geometry 90x25+0-0 # bottom left
xterm -geometry 90x25-0+0 # top right
xterm -geometry 90x25-0-0 # bottom right
and you can select other values than 0
for an arbitrary location.
You find the available options in man xterm
(there are a lot of options).
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
I think the OP is asking for the CLI equivalent ofEdit->Profile Preference->General settings
. Maybe somegsettings
call or something.
â PerlDuck
May 17 at 18:13
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
 |Â
show 7 more comments
up vote
2
down vote
gnome-terminal
If I understand correctly, you are using standard Ubuntu and gnome-terminal
, so you can use the following command line in your script,
gnome-terminal --geometry <columns>x<rows>
for example
gnome-terminal --geometry 135x45
You find the available options in man gnome-terminal
.
xterm
The corresponding command line for good old xterm
is
xterm -geometry 135x45
where you can add details to set the absolute position on the desktop (in pixels). Test these command lines,
xterm -geometry 90x25+0+0 # top left
xterm -geometry 90x25+0-0 # bottom left
xterm -geometry 90x25-0+0 # top right
xterm -geometry 90x25-0-0 # bottom right
and you can select other values than 0
for an arbitrary location.
You find the available options in man xterm
(there are a lot of options).
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
I think the OP is asking for the CLI equivalent ofEdit->Profile Preference->General settings
. Maybe somegsettings
call or something.
â PerlDuck
May 17 at 18:13
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
 |Â
show 7 more comments
up vote
2
down vote
up vote
2
down vote
gnome-terminal
If I understand correctly, you are using standard Ubuntu and gnome-terminal
, so you can use the following command line in your script,
gnome-terminal --geometry <columns>x<rows>
for example
gnome-terminal --geometry 135x45
You find the available options in man gnome-terminal
.
xterm
The corresponding command line for good old xterm
is
xterm -geometry 135x45
where you can add details to set the absolute position on the desktop (in pixels). Test these command lines,
xterm -geometry 90x25+0+0 # top left
xterm -geometry 90x25+0-0 # bottom left
xterm -geometry 90x25-0+0 # top right
xterm -geometry 90x25-0-0 # bottom right
and you can select other values than 0
for an arbitrary location.
You find the available options in man xterm
(there are a lot of options).
gnome-terminal
If I understand correctly, you are using standard Ubuntu and gnome-terminal
, so you can use the following command line in your script,
gnome-terminal --geometry <columns>x<rows>
for example
gnome-terminal --geometry 135x45
You find the available options in man gnome-terminal
.
xterm
The corresponding command line for good old xterm
is
xterm -geometry 135x45
where you can add details to set the absolute position on the desktop (in pixels). Test these command lines,
xterm -geometry 90x25+0+0 # top left
xterm -geometry 90x25+0-0 # bottom left
xterm -geometry 90x25-0+0 # top right
xterm -geometry 90x25-0-0 # bottom right
and you can select other values than 0
for an arbitrary location.
You find the available options in man xterm
(there are a lot of options).
edited May 17 at 19:31
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
19.5k55594
19.5k55594
answered May 17 at 17:34
![](https://i.stack.imgur.com/lcww5.png?s=32&g=1)
![](https://i.stack.imgur.com/lcww5.png?s=32&g=1)
sudodus
19.8k32666
19.8k32666
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
I think the OP is asking for the CLI equivalent ofEdit->Profile Preference->General settings
. Maybe somegsettings
call or something.
â PerlDuck
May 17 at 18:13
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
 |Â
show 7 more comments
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
I think the OP is asking for the CLI equivalent ofEdit->Profile Preference->General settings
. Maybe somegsettings
call or something.
â PerlDuck
May 17 at 18:13
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
yes, you understand. But I want to type this command each time. When I open terminal automatically should execute this. Keep in mind that I have to done all things in CLI because I have to do this inside a bigger script.
â alhelal
May 17 at 17:39
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
I thought that you wanted the script to open the terminal window and decide its size, and in that case you need not type all this. Simply put the whole command line in the script. -- On the other hand, if you want to do it manually, you can use an alias (interactively) or use a variable in the script to avoid typing more than necessary.
â sudodus
May 17 at 17:52
1
1
I think the OP is asking for the CLI equivalent of
Edit->Profile Preference->General settings
. Maybe some gsettings
call or something.â PerlDuck
May 17 at 18:13
I think the OP is asking for the CLI equivalent of
Edit->Profile Preference->General settings
. Maybe some gsettings
call or something.â PerlDuck
May 17 at 18:13
2
2
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
Maybe you are right. Let us wait for the OP to tell us what they want.
â sudodus
May 17 at 18:18
1
1
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
@sudodus Yes. I have already wrote this in my edited question
â alhelal
May 18 at 3:17
 |Â
show 7 more comments
up vote
0
down vote
It works for me when I unselected use custom default terminal size
Add add
resize -s 50 50 > /dev/null
to ~/.bashrc
After pressing CtrlAltT
add a comment |Â
up vote
0
down vote
It works for me when I unselected use custom default terminal size
Add add
resize -s 50 50 > /dev/null
to ~/.bashrc
After pressing CtrlAltT
add a comment |Â
up vote
0
down vote
up vote
0
down vote
It works for me when I unselected use custom default terminal size
Add add
resize -s 50 50 > /dev/null
to ~/.bashrc
After pressing CtrlAltT
It works for me when I unselected use custom default terminal size
Add add
resize -s 50 50 > /dev/null
to ~/.bashrc
After pressing CtrlAltT
answered May 19 at 4:25
![](https://i.stack.imgur.com/ptbZP.png?s=32&g=1)
![](https://i.stack.imgur.com/ptbZP.png?s=32&g=1)
alhelal
5232623
5232623
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037463%2fhow-to-resize-terminal-window-permanently-using-cli%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password