<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hesam E. Derakhshan on Medium]]></title>
        <description><![CDATA[Stories by Hesam E. Derakhshan on Medium]]></description>
        <link>https://medium.com/@hesamedn?source=rss-18ec1b9c820c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cOMge40eoxxQ9RS5o8eLRA.jpeg</url>
            <title>Stories by Hesam E. Derakhshan on Medium</title>
            <link>https://medium.com/@hesamedn?source=rss-18ec1b9c820c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 06:56:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hesamedn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[All you need to compile or run a code in remote server using SSH]]></title>
            <link>https://hesamedn.medium.com/all-you-need-to-compile-or-run-a-code-in-remote-server-using-ssh-e487d658f22b?source=rss-18ec1b9c820c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e487d658f22b</guid>
            <category><![CDATA[remote-server]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[compile]]></category>
            <dc:creator><![CDATA[Hesam E. Derakhshan]]></dc:creator>
            <pubDate>Sun, 11 Apr 2021 13:48:48 GMT</pubDate>
            <atom:updated>2021-04-12T10:16:52.780Z</atom:updated>
            <content:encoded><![CDATA[<h3>All you need to compile or run a code in a remote server using SSH</h3><p>If you need to compile or run a code in a remote server or computer you should use SSH protocol or Remote Desktop Protocol.</p><h3><strong>What is SSH?</strong></h3><p><a href="https://www.ssh.com/academy/ssh/protocol">The SSH protocol (also referred to as Secure Shell) is a method for secure remote login from one computer to another. It provides several alternative options for strong authentication, and it protects the communications security and integrity with strong encryption.</a></p><p>For more information you can check: <a href="https://www.ssh.com/academy/ssh/protocol">https://www.ssh.com/academy/ssh/protocol</a></p><h3>How to Connect to a remote server via SSH</h3><p>The first thing you need to check is that if you have installed SSH. If you are using Linux or mac or updated windows probably you have got it before. It is simple to check, just open your terminal and type ssh, and press enter button, then if you get feedback like this you have installed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8JG_cIWFulXPYsjoNdZag.png" /><figcaption>Typical feedback for <strong>ssh</strong></figcaption></figure><p>If you don’t get feedback like this, you can install it for Linux from here:</p><p><a href="https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server">https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server</a></p><p>for mac from here:</p><p><a href="https://www.servermania.com/kb/articles/ssh-mac/">How do I SSH on a Mac with Terminal? - ServerMania</a></p><p>for windows from here:</p><p><a href="https://virtualizationreview.com/articles/2020/05/21/ssh-server-on-windows-10.aspx#:~:text=You%20can%20install%20OpenSSH%20Server,OpenSSH%20Server%2C%20and%20clicking%20Install.&amp;text=Once%20added%2C%20it%20will%20be,the%20list%20of%20optional%20features.&amp;text=Once%20it%20is%20installed%2C%20you%20will%20need%20to%20start%20the%20service">SSH Server on Windows 10 -- Virtualization Review</a></p><p>Now if you have the IP of a host server you can connect to the server with your username and password. Open a terminal and run the following command:</p><pre>$ ssh username_on_the_server<strong>@</strong>server_ip</pre><p>for example:</p><pre>$ ssh hessaam@owl.iasbs.ac.ir</pre><p>Type your password and hit Enter. Note that you will not get any feedback on the screen while typing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PnF2bUaQSGrJEbD-3ILnhw.png" /></figure><p>You are now able to run your code and control a remote machine using your terminal.</p><p>If you have trouble to connect visit this link:</p><p><a href="https://phoenixnap.com/kb/ssh-to-connect-to-remote-server-linux-or-windows">How to Use SSH to Connect to a Remote Server in Linux or Windows</a></p><p>For exit from the server and back into local machine press <strong><em>ctrl+ d </em></strong>or write <strong><em>exit </em></strong>in terminal and press enter.</p><h3>Compile or run a code in remote server</h3><p>First, you should copy your code from the local to the remote server.</p><p>Open your terminal in the code directory and use <strong>scp </strong>to<strong> </strong>copy a file from local to remote:</p><pre>$ scp myfile.txt username<strong>@</strong>server_ip:/remote/folder/</pre><p>Now if there have been your requirement packages to compile or run your code in the remote server, you can use the server like your local from the terminal. For example, you can run your python code like this:</p><pre>$ python python_file.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1Oi7u8YQ9A7UZ_RwCnTWA.png" /></figure><h3>How to run a code in the Background</h3><p>You can run a code with <a href="https://en.wikipedia.org/wiki/Nohup"><strong>nohup</strong></a> in the Background which ignores the hangup signal. This means that you can close the terminal without stopping the execution. For example, you can run your python code in the Background like this:</p><pre>$ nohup python3 python_file.py &gt; save_output.log &amp;</pre><p>After press inter you can see process ID also you can find the process and its process ID with this command:</p><pre>ps ax | grep python_file.py</pre><p>If you want to stop the execution, you can kill it with the <a href="https://en.wikipedia.org/wiki/Kill_(command)">kill</a> command:</p><pre>kill [process ID]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5usn6UiuRp1V-0-bsN2QPg.png" /></figure><p>The output will be saved in the save_output.log file</p><p>for more information about running code in the background you can visit these:</p><p><a href="https://janakiev.com/blog/python-background/">https://janakiev.com/blog/python-background/</a></p><p><a href="https://www.tecmint.com/run-linux-command-process-in-background-detach-process/">https://www.tecmint.com/run-linux-command-process-in-background-detach-process/</a></p><h3>Get your result data from the server</h3><p>you can copy your result file from the remote server to the local:</p><pre>$ scp username<strong>@</strong>server_ip:/remote/folder/remotefile.txt  localfile.txt</pre><p>for more information about the copy file in ssh you can visit this:</p><p><a href="https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/">https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e487d658f22b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>