change default command optionsHow to open file with default application from command line?ls system command not showing terminal colorsCommand to list only output files of gcc operation?ls command by default is showing one line per file? How to change it?The foreground color changes after `ls` commandls command to view particular string in filename within directoryCommand 'ls' showing directory size instead of block-sizeOpening shell files via Terminal (default application)Any command to change file names with only 4 digits after decimal point or rounded-off to nearest integerWhy is the current directory in the ls command identified as linked to itself?

How spaceships determine each other's mass in space?

When Central Limit Theorem breaks down

Is it a Cyclops number? "Nobody" knows!

Can I negotiate a patent idea for a raise, under French law?

After Brexit, will the EU recognize British passports that are valid for more than ten years?

Issue with units for a rocket nozzle throat area problem

Ultrafilters as a double dual

If nine coins are tossed, what is the probability that the number of heads is even?

A vote on the Brexit backstop

What does "rhumatis" mean?

Is this Paypal Github SDK reference really a dangerous site?

How can I have x-axis ticks that show ticks scaled in powers of ten?

Propulsion Systems

Too soon for a plot twist?

Help! My Character is too much for her story!

PTIJ: Sport in the Torah

Should we avoid writing fiction about historical events without extensive research?

Why do we call complex numbers “numbers” but we don’t consider 2-vectors numbers?

Why restrict private health insurance?

Vector-transposing function

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Why does this boat have a landing pad? (SpaceX's GO Searcher) Any plans for propulsive capsule landings?

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

Will the concrete slab in a partially heated shed conduct a lot of heat to the unconditioned area?



change default command options


How to open file with default application from command line?ls system command not showing terminal colorsCommand to list only output files of gcc operation?ls command by default is showing one line per file? How to change it?The foreground color changes after `ls` commandls command to view particular string in filename within directoryCommand 'ls' showing directory size instead of block-sizeOpening shell files via Terminal (default application)Any command to change file names with only 4 digits after decimal point or rounded-off to nearest integerWhy is the current directory in the ls command identified as linked to itself?













13















When I enter command



ls


I see a list of files and directories in current directory, the list displayed is quite annoying.



Rather, I like to execute ls command with -1 option like



ls -1


My question is how to change default behavior of ls command such that it will always execute with -1 option. i.e how to display files and directories in one column with ls command.



Thanks.










share|improve this question


























    13















    When I enter command



    ls


    I see a list of files and directories in current directory, the list displayed is quite annoying.



    Rather, I like to execute ls command with -1 option like



    ls -1


    My question is how to change default behavior of ls command such that it will always execute with -1 option. i.e how to display files and directories in one column with ls command.



    Thanks.










    share|improve this question
























      13












      13








      13


      3






      When I enter command



      ls


      I see a list of files and directories in current directory, the list displayed is quite annoying.



      Rather, I like to execute ls command with -1 option like



      ls -1


      My question is how to change default behavior of ls command such that it will always execute with -1 option. i.e how to display files and directories in one column with ls command.



      Thanks.










      share|improve this question














      When I enter command



      ls


      I see a list of files and directories in current directory, the list displayed is quite annoying.



      Rather, I like to execute ls command with -1 option like



      ls -1


      My question is how to change default behavior of ls command such that it will always execute with -1 option. i.e how to display files and directories in one column with ls command.



      Thanks.







      command-line ls






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 13 '12 at 2:52









      hrishikeshp19hrishikeshp19

      4124813




      4124813




















          4 Answers
          4






          active

          oldest

          votes


















          12














          One way would be by creating alias in your ~/.bashrc file:



          alias l1='ls -1'



          then by typing l1, ls -1 will be executed






          share|improve this answer























          • How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

            – AlainD
            Nov 21 '15 at 19:40











          • @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

            – Jishnu
            Jan 22 '16 at 4:46


















          3














          In your Home directory, open .bashrc file in editor and add alias ls='ls -1'.



          First open the terminal ( Press ControlAltT), enter gedit ./.bashrc to open your .bashrc file in the editor.



          Find the section that has some aliases for ls. In mine (stock 11.10) it looks like:



          # some more ls aliases
          alias ll='ls -alF'
          alias la='ls -A'
          alias l='ls -CF'


          Add the following line after the ls aliases:



          alias ls='ls -1'


          Save the file, exit gedit and the terminal and reboot. Now the ls command should execute ls -1 by default.






          share|improve this answer


















          • 1





            This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

            – James
            Feb 13 '12 at 4:03












          • In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

            – AlainD
            Nov 21 '15 at 19:45


















          1














          zetah's answer is the best. To elaborate:



          Aliases are best used for short, simple, often used modifications of command default parameters. They are stored in memory (after being read from their source file), for better performance or repetitive use.



          Functions are appropriate for more complex activity that are often used, and are also stored in memory.



          Scripts are appropriate for the most complex and least often used commands.



          See this question and answers on unix stackexchange - explains the difference in best use between aliases, functions, and scripts.






          share|improve this answer
































            0














            Just to clarify something to @RobDavenport answer. You can't use a function to override a command that has the same name.



            e.g. to add a default param to the ls command you can do :



            alias ls='ls -1 $@'


            This will add a new alias called ls so it will be called instead of the original command. It will add the -1 option and forward every parameter $@ to the original ls command.



            You could also do



            function ls_column () 
            ls -1 $@



            It would have the same effect but you must use a different name for your function. Otherwise it will call itself again and again.






            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',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              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%2f103742%2fchange-default-command-options%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              12














              One way would be by creating alias in your ~/.bashrc file:



              alias l1='ls -1'



              then by typing l1, ls -1 will be executed






              share|improve this answer























              • How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

                – AlainD
                Nov 21 '15 at 19:40











              • @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

                – Jishnu
                Jan 22 '16 at 4:46















              12














              One way would be by creating alias in your ~/.bashrc file:



              alias l1='ls -1'



              then by typing l1, ls -1 will be executed






              share|improve this answer























              • How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

                – AlainD
                Nov 21 '15 at 19:40











              • @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

                – Jishnu
                Jan 22 '16 at 4:46













              12












              12








              12







              One way would be by creating alias in your ~/.bashrc file:



              alias l1='ls -1'



              then by typing l1, ls -1 will be executed






              share|improve this answer













              One way would be by creating alias in your ~/.bashrc file:



              alias l1='ls -1'



              then by typing l1, ls -1 will be executed







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 13 '12 at 2:59









              zetahzetah

              5,85973967




              5,85973967












              • How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

                – AlainD
                Nov 21 '15 at 19:40











              • @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

                – Jishnu
                Jan 22 '16 at 4:46

















              • How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

                – AlainD
                Nov 21 '15 at 19:40











              • @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

                – Jishnu
                Jan 22 '16 at 4:46
















              How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

              – AlainD
              Nov 21 '15 at 19:40





              How do you find the ~/.bashrc file? I found the "bash" application in Computerbin, but not a text file with the name you mention.

              – AlainD
              Nov 21 '15 at 19:40













              @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

              – Jishnu
              Jan 22 '16 at 4:46





              @AlainD the .bashrc file is present in your home directory, not in /bin . The ~ expands to your home directory in bash, so the path would read something like /home/user/.bashrc

              – Jishnu
              Jan 22 '16 at 4:46













              3














              In your Home directory, open .bashrc file in editor and add alias ls='ls -1'.



              First open the terminal ( Press ControlAltT), enter gedit ./.bashrc to open your .bashrc file in the editor.



              Find the section that has some aliases for ls. In mine (stock 11.10) it looks like:



              # some more ls aliases
              alias ll='ls -alF'
              alias la='ls -A'
              alias l='ls -CF'


              Add the following line after the ls aliases:



              alias ls='ls -1'


              Save the file, exit gedit and the terminal and reboot. Now the ls command should execute ls -1 by default.






              share|improve this answer


















              • 1





                This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

                – James
                Feb 13 '12 at 4:03












              • In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

                – AlainD
                Nov 21 '15 at 19:45















              3














              In your Home directory, open .bashrc file in editor and add alias ls='ls -1'.



              First open the terminal ( Press ControlAltT), enter gedit ./.bashrc to open your .bashrc file in the editor.



              Find the section that has some aliases for ls. In mine (stock 11.10) it looks like:



              # some more ls aliases
              alias ll='ls -alF'
              alias la='ls -A'
              alias l='ls -CF'


              Add the following line after the ls aliases:



              alias ls='ls -1'


              Save the file, exit gedit and the terminal and reboot. Now the ls command should execute ls -1 by default.






              share|improve this answer


















              • 1





                This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

                – James
                Feb 13 '12 at 4:03












              • In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

                – AlainD
                Nov 21 '15 at 19:45













              3












              3








              3







              In your Home directory, open .bashrc file in editor and add alias ls='ls -1'.



              First open the terminal ( Press ControlAltT), enter gedit ./.bashrc to open your .bashrc file in the editor.



              Find the section that has some aliases for ls. In mine (stock 11.10) it looks like:



              # some more ls aliases
              alias ll='ls -alF'
              alias la='ls -A'
              alias l='ls -CF'


              Add the following line after the ls aliases:



              alias ls='ls -1'


              Save the file, exit gedit and the terminal and reboot. Now the ls command should execute ls -1 by default.






              share|improve this answer













              In your Home directory, open .bashrc file in editor and add alias ls='ls -1'.



              First open the terminal ( Press ControlAltT), enter gedit ./.bashrc to open your .bashrc file in the editor.



              Find the section that has some aliases for ls. In mine (stock 11.10) it looks like:



              # some more ls aliases
              alias ll='ls -alF'
              alias la='ls -A'
              alias l='ls -CF'


              Add the following line after the ls aliases:



              alias ls='ls -1'


              Save the file, exit gedit and the terminal and reboot. Now the ls command should execute ls -1 by default.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 13 '12 at 4:01









              JamesJames

              9,29951936




              9,29951936







              • 1





                This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

                – James
                Feb 13 '12 at 4:03












              • In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

                – AlainD
                Nov 21 '15 at 19:45












              • 1





                This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

                – James
                Feb 13 '12 at 4:03












              • In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

                – AlainD
                Nov 21 '15 at 19:45







              1




              1





              This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

              – James
              Feb 13 '12 at 4:03






              This redefines "ls" to now operate as "ls -1" by default for this user. If you'd rather use a new command, then @zetah answer covers that.

              – James
              Feb 13 '12 at 4:03














              In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

              – AlainD
              Nov 21 '15 at 19:45





              In my Home directory on uBuntu 14.04 LTS I only see a bunch of folder, and no .bashrc file.

              – AlainD
              Nov 21 '15 at 19:45











              1














              zetah's answer is the best. To elaborate:



              Aliases are best used for short, simple, often used modifications of command default parameters. They are stored in memory (after being read from their source file), for better performance or repetitive use.



              Functions are appropriate for more complex activity that are often used, and are also stored in memory.



              Scripts are appropriate for the most complex and least often used commands.



              See this question and answers on unix stackexchange - explains the difference in best use between aliases, functions, and scripts.






              share|improve this answer





























                1














                zetah's answer is the best. To elaborate:



                Aliases are best used for short, simple, often used modifications of command default parameters. They are stored in memory (after being read from their source file), for better performance or repetitive use.



                Functions are appropriate for more complex activity that are often used, and are also stored in memory.



                Scripts are appropriate for the most complex and least often used commands.



                See this question and answers on unix stackexchange - explains the difference in best use between aliases, functions, and scripts.






                share|improve this answer



























                  1












                  1








                  1







                  zetah's answer is the best. To elaborate:



                  Aliases are best used for short, simple, often used modifications of command default parameters. They are stored in memory (after being read from their source file), for better performance or repetitive use.



                  Functions are appropriate for more complex activity that are often used, and are also stored in memory.



                  Scripts are appropriate for the most complex and least often used commands.



                  See this question and answers on unix stackexchange - explains the difference in best use between aliases, functions, and scripts.






                  share|improve this answer















                  zetah's answer is the best. To elaborate:



                  Aliases are best used for short, simple, often used modifications of command default parameters. They are stored in memory (after being read from their source file), for better performance or repetitive use.



                  Functions are appropriate for more complex activity that are often used, and are also stored in memory.



                  Scripts are appropriate for the most complex and least often used commands.



                  See this question and answers on unix stackexchange - explains the difference in best use between aliases, functions, and scripts.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 13 '17 at 12:37









                  Community

                  1




                  1










                  answered Feb 13 '12 at 3:44









                  RobDavenportRobDavenport

                  37116




                  37116





















                      0














                      Just to clarify something to @RobDavenport answer. You can't use a function to override a command that has the same name.



                      e.g. to add a default param to the ls command you can do :



                      alias ls='ls -1 $@'


                      This will add a new alias called ls so it will be called instead of the original command. It will add the -1 option and forward every parameter $@ to the original ls command.



                      You could also do



                      function ls_column () 
                      ls -1 $@



                      It would have the same effect but you must use a different name for your function. Otherwise it will call itself again and again.






                      share|improve this answer





























                        0














                        Just to clarify something to @RobDavenport answer. You can't use a function to override a command that has the same name.



                        e.g. to add a default param to the ls command you can do :



                        alias ls='ls -1 $@'


                        This will add a new alias called ls so it will be called instead of the original command. It will add the -1 option and forward every parameter $@ to the original ls command.



                        You could also do



                        function ls_column () 
                        ls -1 $@



                        It would have the same effect but you must use a different name for your function. Otherwise it will call itself again and again.






                        share|improve this answer



























                          0












                          0








                          0







                          Just to clarify something to @RobDavenport answer. You can't use a function to override a command that has the same name.



                          e.g. to add a default param to the ls command you can do :



                          alias ls='ls -1 $@'


                          This will add a new alias called ls so it will be called instead of the original command. It will add the -1 option and forward every parameter $@ to the original ls command.



                          You could also do



                          function ls_column () 
                          ls -1 $@



                          It would have the same effect but you must use a different name for your function. Otherwise it will call itself again and again.






                          share|improve this answer















                          Just to clarify something to @RobDavenport answer. You can't use a function to override a command that has the same name.



                          e.g. to add a default param to the ls command you can do :



                          alias ls='ls -1 $@'


                          This will add a new alias called ls so it will be called instead of the original command. It will add the -1 option and forward every parameter $@ to the original ls command.



                          You could also do



                          function ls_column () 
                          ls -1 $@



                          It would have the same effect but you must use a different name for your function. Otherwise it will call itself again and again.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 10 hours ago









                          Junkhacker

                          33




                          33










                          answered Dec 12 '17 at 8:39









                          TimTim

                          1013




                          1013



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f103742%2fchange-default-command-options%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                              Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                              Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»