How to resize terminal window permanently using CLI?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite
1












Inside the terminal when I type resize -s 50 50 terminal output is changed as rows 50 and columns 50.



enter image description here



But after closing the window and reopen terminal doesn't reflect the changes.



enter image description here



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



enter image description here



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.






share|improve this question


























    up vote
    1
    down vote

    favorite
    1












    Inside the terminal when I type resize -s 50 50 terminal output is changed as rows 50 and columns 50.



    enter image description here



    But after closing the window and reopen terminal doesn't reflect the changes.



    enter image description here



    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



    enter image description here



    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.






    share|improve this question
























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      Inside the terminal when I type resize -s 50 50 terminal output is changed as rows 50 and columns 50.



      enter image description here



      But after closing the window and reopen terminal doesn't reflect the changes.



      enter image description here



      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



      enter image description here



      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.






      share|improve this question














      Inside the terminal when I type resize -s 50 50 terminal output is changed as rows 50 and columns 50.



      enter image description here



      But after closing the window and reopen terminal doesn't reflect the changes.



      enter image description here



      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



      enter image description here



      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.








      share|improve this question













      share|improve this question




      share|improve this question








      edited May 19 at 4:08

























      asked May 17 at 16:37









      alhelal

      5232623




      5232623




















          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






          share|improve this answer






















          • 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










          • @alhelal I updated my answer, try the second option
            – Eskander Bejaoui
            May 17 at 21:38






          • 1




            +1. Thanks for finding how to use gsettings and showing a solution :-)
            – sudodus
            May 18 at 16:47






          • 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


















          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).






          share|improve this answer






















          • 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 of Edit->Profile Preference->General settings. Maybe some gsettings 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

















          up vote
          0
          down vote













          It works for me when I unselected use custom default terminal size



          enter image description here



          enter image description here



          Add add



          resize -s 50 50 > /dev/null 


          to ~/.bashrc



          After pressing CtrlAltT



          enter image description here






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            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






























            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






            share|improve this answer






















            • 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










            • @alhelal I updated my answer, try the second option
              – Eskander Bejaoui
              May 17 at 21:38






            • 1




              +1. Thanks for finding how to use gsettings and showing a solution :-)
              – sudodus
              May 18 at 16:47






            • 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















            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






            share|improve this answer






















            • 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










            • @alhelal I updated my answer, try the second option
              – Eskander Bejaoui
              May 17 at 21:38






            • 1




              +1. Thanks for finding how to use gsettings and showing a solution :-)
              – sudodus
              May 18 at 16:47






            • 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













            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






            share|improve this answer














            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







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 17 at 21:33

























            answered May 17 at 16:58









            Eskander Bejaoui

            1,0141619




            1,0141619











            • 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










            • @alhelal I updated my answer, try the second option
              – Eskander Bejaoui
              May 17 at 21:38






            • 1




              +1. Thanks for finding how to use gsettings and showing a solution :-)
              – sudodus
              May 18 at 16:47






            • 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

















            • 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










            • @alhelal I updated my answer, try the second option
              – Eskander Bejaoui
              May 17 at 21:38






            • 1




              +1. Thanks for finding how to use gsettings and showing a solution :-)
              – sudodus
              May 18 at 16:47






            • 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
















            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













            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).






            share|improve this answer






















            • 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 of Edit->Profile Preference->General settings. Maybe some gsettings 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














            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).






            share|improve this answer






















            • 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 of Edit->Profile Preference->General settings. Maybe some gsettings 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












            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).






            share|improve this answer
















            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).







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 17 at 19:31









            dessert

            19.5k55594




            19.5k55594










            answered May 17 at 17:34









            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 of Edit->Profile Preference->General settings. Maybe some gsettings 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











            • 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 of Edit->Profile Preference->General settings. Maybe some gsettings 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










            up vote
            0
            down vote













            It works for me when I unselected use custom default terminal size



            enter image description here



            enter image description here



            Add add



            resize -s 50 50 > /dev/null 


            to ~/.bashrc



            After pressing CtrlAltT



            enter image description here






            share|improve this answer
























              up vote
              0
              down vote













              It works for me when I unselected use custom default terminal size



              enter image description here



              enter image description here



              Add add



              resize -s 50 50 > /dev/null 


              to ~/.bashrc



              After pressing CtrlAltT



              enter image description here






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                It works for me when I unselected use custom default terminal size



                enter image description here



                enter image description here



                Add add



                resize -s 50 50 > /dev/null 


                to ~/.bashrc



                After pressing CtrlAltT



                enter image description here






                share|improve this answer












                It works for me when I unselected use custom default terminal size



                enter image description here



                enter image description here



                Add add



                resize -s 50 50 > /dev/null 


                to ~/.bashrc



                After pressing CtrlAltT



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 19 at 4:25









                alhelal

                5232623




                5232623






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491