<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EZ Linux Admin &#187; cheat sheet</title>
	<atom:link href="http://www.ezlinuxadmin.com/tag/cheat-sheet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ezlinuxadmin.com</link>
	<description>Making Linux Easier</description>
	<lastBuildDate>Tue, 29 Jun 2010 19:37:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unix cheat sheet</title>
		<link>http://www.ezlinuxadmin.com/2007/12/unix-cheat-sheet/</link>
		<comments>http://www.ezlinuxadmin.com/2007/12/unix-cheat-sheet/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 20:11:07 +0000</pubDate>
		<dc:creator>EZ linux</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[cheat sheet]]></category>

		<guid isPermaLink="false">http://ezlinuxadmin.com/?p=7</guid>
		<description><![CDATA[Telnet Telnet allows you to login, albeit insecurely, to any remote machine running                  a telnet server.                  Telnet will allow you to [...]]]></description>
			<content:encoded><![CDATA[<p><font face="Verdana, Arial, Helvetica, sans-serif" size="+2">Telnet<a name="telnet"></a> </font><font face="Verdana, Arial, Helvetica, sans-serif" size="+2"><font size="-1">Telnet allows you to login, albeit insecurely, to any remote machine running                  a telnet <a href="http://info-center.ccit.arizona.edu/%7Ecnl/unixintro.htm#clients">server</a>.                  Telnet will allow you to open a shell and use simple command line                  unix tools on the remote machine.</font></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;telnet                  fred</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">In                  this example, imagine you are telnetting to a machine named &#8220;fred&#8221;.                  Sometimes you may have to use the fully qualified name of the                  machine (e.g., Fred.arizona.edu) or use Fred&#8217;s IP address: 128.196.99.1.                  You will need to login to Fred and provide your password.</font></p>
<hr /> <font face="Verdana, Arial, Helvetica, sans-serif" size="+2">Ftp<a name="ftp"></a></font><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">FTP                  is the file transfer protocol. Like telnet, it is an old insecure                  protocol. It is being replaced by scp, but is still in use on                  some machines. FTP can operate in text or binary mode, with the                  prompt on or off. It can get files from the remote machine or                  put files on the remote machine, either singly or in large batches.                  By default, ftp operates in text mode with the prompt on, we usually                  alter these defaults at the beginning of a new ftp session. FTP                  will allow you to cd between directories, but it may have trouble                  with listing, copying, moving and removing files and directories.                  Telnet is better suited for these general unix commands.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">To                  start an ftp connection from a unix machine:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;ftp                  Fred</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">As                  with telnet above, you may sometimes need to use Fred&#8217;s fully                  qualified domain name or IP address and you will need to login.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;bin</strong>                  (this will tell ftp to transfer the data in binary mode instead                  of text mode. You will typically be tranferring image data, so                  you want to be in binary mode. In fact, it never hurts to be in                  binary mode, even if you are transferring text files.)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;prompt</strong> (this will tell ftp not to ask you about transferring                  each individual file. If you are about to move dozens of files,                  you will want to type &#8220;prompt&#8221;).</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><font size="+1">Local and Remote Machines (Understanding get and put)</font></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">In                  the simplest scenario, I sit down at one machine (e.g., &#8220;Mary&#8221;)                  and I ftp to another machine (e.g., &#8220;Fred&#8221;):</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;ftp                  Fred</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">In                  this case, Mary is my local machine and Fred is the remote machine.                  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">However,                  it can be much more complicated. Suppose I&#8217;m sitting at home at                  my PC and I telnet to Mary. After logging in to Mary, I ftp Fred.                  Again, Mary is the local machine (the machine where I started                  the ftp session) and Fred is the remote machine. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Let&#8217;s                  make it even worse. I telnet from home to Mary. Then I telnet                  from Mary to Fred, and then ftp from Fred to Mary. Now Fred is                  the local machine and Mary is the remote machine. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">To                  understand when to use &#8220;get&#8221; or &#8220;mget&#8221; versus &#8220;put&#8221; or &#8220;mput&#8221;,                  you must understand these abstract concepts of the remote and                  local machines. However, it does get confusing, so if you try                  &#8220;put&#8221; and get back a message like &#8220;no such file or directory&#8221;,                  then try &#8220;get&#8221; instead.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Let&#8217;s                  go back to the simplest case, I ftp from Mary to Fred. Mary is                  my local machine. </font></p>
<ul>
<li><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">I                    should use &#8220;put&#8221; or &#8220;mput&#8221; to transfer files from Mary (local)                    to Fred (remote). </font></li>
<li><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">I                    should use &#8220;get&#8221; or &#8220;mget&#8221; to transfer files from Fred (remote)                    to Mary (local).</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">You                  should start your ftp session in the directory on the local machine                  where files to transfer reside or where you intend to place them.                  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">You                  can use the &#8220;cd&#8221; command to move around on the remote machine                  once you have ftp&#8217;d there</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;cd                  /data/tmp</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">Examples</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;put                  P01000</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">In                  this example &#8220;put&#8221; is used to copy a single specified file from                  the local machine (specifically, from the directory you started                  the ftp session in) to the remote machine (the directory you are                  in on the remote machine).</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;mput                  P*</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">&#8220;mput&#8221;                  [multiple puts] tells ftp to copy all files that meet the criterion,                  in this case, all files beginning with a capital P, from the current                  directory on the local machine to the current directory on the                  remote machine.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;get                  bird.jpg</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Copy                  a single file &#8220;bird.jpg&#8221; from the current directory on the remote                  machine to the current directory on the local machine.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;mget                  *.jpg</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Copy                  all &#8220;*.jpg&#8221; files from the current directory on the remote machine                  to the current directory on the local machine.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>ftp&gt;bye</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Exits                  the ftp session</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;man                  ftp</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Tells                  you more about the options and flags available with ftp.</font></p>
<hr /> <font face="Verdana, Arial, Helvetica, sans-serif" size="+2">SSH<a name="ssh"></a></font><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">ssh=secure                  shell (secure telnet)</font><br />
<font face="Verdana, Arial, Helvetica, sans-serif" size="-1">To                  use these programs, they must be installed on both communicating                  machines. For a machine to receive an ssh or scp request (i.e.,                  for it to answer when you request a connection to it) it must                  be running an ssh <a href="http://info-center.ccit.arizona.edu/%7Ecnl/unixintro.htm#clients">server</a>                  (sshd). Typically only unix machines will run ssh servers. If                  you have trouble connecting to a machine with ssh, you should                  check to see if it is running an ssh server (or daemon):</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;which                  sshd</strong></font></p>
<p><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">&gt;ps                  -ef | sshd</font></strong></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">Same                  user on local and remote machines</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">The                  commands you are most likely to need:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">ssh                  machinename (where the name of the machine or IP address is substituted                  for the term &#8220;machinename&#8221;), e.g.,</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;ssh                  buddy</strong> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">ssh                  assumes you want to be the same user on the machine you are sshing                  TO</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">as                  you are on the machine you are coming FROM. This can be annoying.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">Different                  user on local and remote machines</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">If                  you want to login as a different user, use the following scheme:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">ssh                  -l username machinename</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">e.g.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;ssh                  -l joe buddy</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">or</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;ssh                  -l joe buddy.psych.arizona.edu</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">(-l                  = &#8220;login as&#8221;)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">You                  will be asked for the password.</font></p>
<hr /> <font face="Verdana, Arial, Helvetica, sans-serif" size="+2">SCP<a name="scp"></a></font><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">same                  user on local and remote machines</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">scp=secure                  copy (secure binary mode ftp)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Unix:                  You can use scp at the command line whether or not have used ssh                  to connect to another machine. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Windows                  PC: If you are using the university ssh and scp on a Windows PC,                  then you have a separate scp program as well as being able to                  use scp at the command line once you have connected with ssh.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">SCP                  move files to or from your current location. It always uses binary                  mode. You can work as either the current user on the starting                  machine or a different user. It always asks for the user&#8217;s password.                  Here are some examples in which I move the file bird.jpg from                  one place to another. The first three examples assume you are                  the same user on the local and remote machines. The last example                  shows you how to login as someone else on the remote machine:                  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Put                  a file on a remote machine: </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  bird.jpg buddy:/data/joe/</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Get                  a file from a remote machine:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  buddy:/data/joe/bird.jpg .</strong></font><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"> (the &#8220;.&#8221; means &#8220;here&#8221;)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  buddy:/data/joe/bird.jpg /home/fred/</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">(does                  the same thing, but just substitutes the path for &#8220;.&#8221;)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">You                  can scp -r so that an entire directory can be copied at a time:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  -r e12345 buddy:/data/joe</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">different                  user on local and remote machines</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Log                  in as someone other than who you are locally, then copy a file                  from your current directory to a directory (/data/fred/) on the                  remote machine:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  bird.jpg joe@buddy:/data/fred</strong></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">(you                  will be asked for joe&#8217;s password)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Copy                  a file (bird.jpg) from a directory (/data/fred/) on a remote machine                  (buddy) where you will login as someone else (joe) to here (.)</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>&gt;scp                  joe@buddy:/data/fred/bird.jpg .</strong></font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ezlinuxadmin.com/2007/12/unix-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
