Score:0

ssh to a remote terminal and bypassing dotrc files

nl flag

I want to rapidly execute a remote command using ssh, for example ls -al /path/to/myfile. Unfortunately, I'm using tcsh rather than bash. My .cshrc file is quite long and slow, so I'd like to bypass it. If I were using bash, I could (presumably) run

ssh [email protected] "bash --noprofile --norc" < lsFile

where lsFile contained the ls command. But tcsh doesn't support either of these flags. Is there an alternative way to accomplish the same effect within the tcsh shell?

If not, an alternative would be to condition on something at the top of my .cshrc file and exit it prematurely. I can't simply condition on whether I have an ssh connection, because for most of my ssh connections, I want to run the full .cshrc file. So I'd need to send the conditioning token within this particular ssh command. Is this possible?

ar flag
Which version and distro of Linux are you using?
hr flag
`man tcsh` suggests the equivalent option is `-f` (*The shell does not load any resource or startup files, or perform any command hashing, and thus starts faster.*)
nl flag
@user68186, I'm running ubuntu, 20.04. Here's the output of `uname -a` `Linux 7420 5.13.0-1010-oem #11-Ubuntu SMP Wed Jul 28 13:04:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux` Thanks @steeldriver, I don't know how I missed that. The command took 5 seconds instead of 7, which is something of an improvement!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.