Announcement

Collapse
No announcement yet.

How do I create aliases?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by kubicle View Post
    The immediately apparent difference between 'sudo -sH' and 'sudo -i' is the $PWD, the former keeps the current working directory (comparable to 'su') while the latter switches to root's home directory (comparable to 'su -', 'su -l' or 'su --login')...of course you can set an alias for both.
    Another difference is -i starts a full login shell, -s only starts an interactive shell... This makes most difference when you have customised the shell login some how over just the interactive starting.

    Comment


      #17
      Originally posted by michel View Post
      Thanks for the clarifications I get most of it except the saving as .bash_aliases if you could give a concrete example I would appreciate it.
      You can just do something like:
      Code:
      echo "alias su='sudo -i'" >> ~/.bash_aliases
      which will create your first alias and the file ~/.bash_aliases (if it doesn't exist).
      You can then edit the file with a text editor or use another echo command to add additional aliases. Remember to 'source ~/.bash_aliases' or restart your shell for your new aliases to take effect.

      Comment


        #18
        Originally posted by james147 View Post
        Another difference is -i starts a full login shell, -s only starts an interactive shell... This makes most difference when you have customised the shell login some how over just the interactive starting.
        I take it the difference is reading the various profile files or not.

        Comment


          #19
          Originally posted by kubicle View Post
          I take it the difference is reading the various profile files or not.
          Basically, possibly some pam related stuff but I am not entirely sure... the difference on a default kubuntu install is very minimal though, you only really need to worry about this (and probably already understand more about it) if you customise the login process at all.

          Comment


            #20
            I did an alias for su=sudo -i and another reload='source ~/.bash_aliases'

            Thanks to all.

            Michel

            Comment

            Working...
            X