2008-07-29-how-to-execute-linux-commands-from-windows.md 1.32 KB
 Danesh Manoharan committed Feb 20, 2022 1 2 --- title: How To Execute Linux commands from Windows  3 author: Danesh Manoharan  Danesh Manoharan committed Feb 20, 2022 4 5 6 7 8 9 10 11 12 date: 2008-07-28T16:35:11+00:00 robotsmeta: - index,follow pvc_views: - 13067 dsq_thread_id: - 890122420 ---  Danesh Manoharan committed Feb 25, 2022 13 Most of the time, users are having a Windows Machine on their desk or laptop. Normally, we want to perform a full scale data retrieval from our Linux servers in the DC, where we don't have a trusted Linux server to manage it....the answer to it is use "PLINK" utility.  Danesh Manoharan committed Feb 20, 2022 14   Danesh Manoharan committed Feb 25, 2022 15 Plink comes together with the Putty...  Danesh Manoharan committed Feb 20, 2022 16 17 18  A simple example of usage is:  Danesh Manoharan committed Feb 25, 2022 19 _**C:\> plink USERNAME@SERVERNAME 'YOUR-LINUX-COMMAND'**_  Danesh Manoharan committed Feb 20, 2022 20   Danesh Manoharan committed Feb 25, 2022 21 If you have a dozen of servers...then you probably want to write a batch script in Windows to loop through a list of servers and mention the list of commands juz like what i did.....  Danesh Manoharan committed Feb 20, 2022 22 23 24 25 26  Here a typical windows batch script: _**@echo off**_  Danesh Manoharan committed Feb 25, 2022 27 _**for / f "tokens=*" %%A in (your-server-list.txt) ( C:\path\to\plink.exe user@server -w YOUR-PASSWORD -m linuxcommandscript > YOUR\_OUTPUT\_FILE.txt)**_  Danesh Manoharan committed Feb 20, 2022 28   Danesh Manoharan committed Feb 25, 2022 29 There you go, i did this for my sar report data collection for root cause analysis and infrastructure load analysis....keying in a password wif every darn login is impractical and yet you dont want to generate a security key for the servers.