How SSH remotely executes commands and exits automatically

Source: Internet
Author: User
Tags format ssh port number

The SSH command format is as follows:

USAGE:SSH [ -1246AACFGKKMNNQSTTVVXXYY] [-B bind_address] [-c Cipher_spec]  
           [-D [Bind_address:]port] [-e Escape_char] [F ConfigFile]  
           [I. PKCS11] [I. Identity_file]  
           [-l [Bind_address:]port:host:hostport]  
           [-L login_name] [M Mac_spec] [-O ctl_cmd] [-o option] [-P Port]  
           [R [Bind_address:]port:host:hostport] [-S Ctl_path]  
           [-W Host:port] [w Local_tun[:remote_tun]]  
           [User@]hostname [command]

Main parameter Description:

-L Specify Login user

-P Set the port number

-F background run, plus-n parameter is recommended

-n redirects standard input to/dev/null to prevent reading standard input

-N Do not execute remote commands, only port forwarding

-Q Quiet mode, ignoring all conversations and error prompts

-T disabling pseudo terminal configuration

SSH executes remote command format:

SSH [Options][remote Host][command]


Assume that the remote server IP is 192.168.110.34

Example: Viewing CPU information for a remote server

Ssh-l www-online 192.168.110.34 "Cat/proc/cpuinfo"

www-online@onlinedev01:~$ ssh-l www-online 192.168.110.34 "Cat/proc/cpuinfo" www-online@192.168.110.34 ' s password: processor:0 Vendor_id:genuineintel CPU Family:6 model:26 model Name:inte   
L (R) Xeon (r) CPU E5506 @ 2.13GHz stepping:5 CPU mhz:2128.000 cache size:4096 KB Fpu:yes fpu_exception:yes cpuid level:11 wp:yes VM E de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 clflush DTS ACPI MMX FXSR SSE SSE2 SS Syscall NX RDTSCP LM constant_tsc Arch_perfmon pebs BTS rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 sse4_2  popcnt hypervisor lahf_lm bogomips:4256.00 clflush size:64 address cache_alignment:64 Bits physical, bits virtual power management:processor:1 Vendor_id:genuineintel CPU FA   Mily:6 model        : Model Name:intel (R) Xeon (r) CPU E5506 @ 2.13GHz stepping:5 CPU MHz:              2128.000 Cache size:4096 KB fpu:yes fpu_exception:yes cpuid level:11 wp : Yes Flags:fpu vme de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 clflush DTS ACPI mm X FXSR SSE SSE2 SS Syscall NX rdtscp LM constant_tsc Arch_perfmon pebs BTS rep_good xtopology tsc_reliable NONSTOP_TSC Ape Rfmperf PNI ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm bogomips:4260.80 clflush size:64 cache_ alignment:64 address sizes:40 bits physical, and BITS virtual power management:

Back to the column page: http://www.bianceng.cn/Programming/extra/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.