Skip to main content
added 132 characters in body
Source Link
heemayl
  • 58.1k
  • 9
  • 129
  • 144

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

Precisely, non-interactive session of bash can read the file defined by the environment variable BASH_ENV or ENV (if set).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

Also note that, aliases are standalone, they don't take any argument like you are providing a directory name. You need to use functions to have arguments as inputs. A similar function definition would be:

ll_f () { ls -al --color=auto "$@" ;}

Now you can do:

ll_f /dir_name

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

Also note that, aliases are standalone, they don't take any argument like you are providing a directory name. You need to use functions to have arguments as inputs. A similar function definition would be:

ll_f () { ls -al --color=auto "$@" ;}

Now you can do:

ll_f /dir_name

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

Precisely, non-interactive session of bash can read the file defined by the environment variable BASH_ENV or ENV (if set).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

Also note that, aliases are standalone, they don't take any argument like you are providing a directory name. You need to use functions to have arguments as inputs. A similar function definition would be:

ll_f () { ls -al --color=auto "$@" ;}

Now you can do:

ll_f /dir_name
added 301 characters in body
Source Link
heemayl
  • 58.1k
  • 9
  • 129
  • 144

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

Also note that, aliases are standalone, they don't take any argument like you are providing a directory name. You need to use functions to have arguments as inputs. A similar function definition would be:

ll_f () { ls -al --color=auto "$@" ;}

Now you can do:

ll_f /dir_name

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'

Also note that, aliases are standalone, they don't take any argument like you are providing a directory name. You need to use functions to have arguments as inputs. A similar function definition would be:

ll_f () { ls -al --color=auto "$@" ;}

Now you can do:

ll_f /dir_name
Source Link
heemayl
  • 58.1k
  • 9
  • 129
  • 144

~/.bashrc is read by an non-login, interactive session of bash, not by non-interactive sessions.

ssh remote some_command is running some_command in an non-interactive session of bash, hence the remote ~/.bashrc is not being read (and of course reading the local one is out of question).

If you want to stick with the aliases, open the shell in interactive mode too:

ssh remote bash -ic 'll'