<?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>Tech Buzzing &#187; UNIX</title>
	<atom:link href="http://www.techbuzzing.com/category/technology/computer/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techbuzzing.com</link>
	<description></description>
	<lastBuildDate>Mon, 14 Jun 2010 11:52:52 +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: Viewing the Contents of Directories</title>
		<link>http://www.techbuzzing.com/2009/12/unix-viewing-the-contents-of-directories/</link>
		<comments>http://www.techbuzzing.com/2009/12/unix-viewing-the-contents-of-directories/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 12:34:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Tips And Tricks]]></category>

		<guid isPermaLink="false">http://www.techbuzzing.com/?p=640</guid>
		<description><![CDATA[
You will frequently need to move up and down the directory structure to work with specific files or other directories. UNIX has many commands that enable you to do so.

Command: pwd
What it does: Shows you the full path to your current location
Use the pwd command when you aren&#8217;t sure about the directory in which you [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-medium wp-image-641" title="UNIX logo" src="http://www.techbuzzing.com/wp-content/uploads/2009/12/UNIX-logo-300x128.gif" alt="UNIX logo" width="300" height="128" /></p>
<p>You will frequently need to move up and down the directory structure to work with specific files or other directories. UNIX has many commands that enable you to do so.</p>
<p><span id="more-640"></span></p>
<p>Command: <tt><span style="font-size: 10.0pt;">pwd</span></tt></p>
<p>What it does: Shows you the full path to your current location</p>
<p>Use the <tt><span style="font-size: 10.0pt;">pwd</span></tt> command when <a name="idd1e34620"></a><a name="idd1e34617"></a>you aren&#8217;t sure about the directory in which you are currently located. When you use the command, you will see the full path in which you are working. This can be helpful as you move around the directories if you become confused about where you are.</p>
<p>Command: <tt><span style="font-size: 10.0pt;">cd</span></tt> <tt><span style="font-size: 10.0pt;">pathname</span></tt></p>
<p>What it does: Changes your directory location to the one in the path <tt><span style="font-size: 10.0pt;">pathname</span></tt></p>
<p><strong>When a specific command is listed in a step, you should ignore the period at the end of the command. For example, in the following steps, don&#8217;t type the period after the command </strong><tt><strong>cd music</strong></tt><strong> in Step 1.</strong></p>
<ol>
<li>Type <tt>cd Music</tt>. The prompt will change to <tt>[localhost:~/Music]</tt> to indicate that you are in the Music directory in your Home directory.</li>
</ol>
<p><strong>Remember that the </strong><tt><strong>~</strong></tt><strong> represents your Home directory, so </strong><tt><strong>~/Musi</strong></tt><strong>c means that you are in the Music directory that is within your Home directory. This can help you take some shortcuts when entering paths as you will see in the next step.</strong></p>
<p>Also remember that the forward slash (<tt>/</tt>) in a path indicates a change in level in the hierarchy. If you are in your Home directory and type <tt>cd /Music</tt>, you will get a message telling you that no such directory exists. When you enter the forward slash, Unix looks back to the highest level in the structure and there is a directory called Music in that directory. Leaving the <tt>/</tt> out indicates that Unix should look in the current directory, which is where the directory is actually located.</p>
<ol>
<li>Type <tt>cd /Users/shortusername</tt>, where <tt>shortusername</tt> is the short username for your account. This will move you back into your Home directory. You include the <tt>/User/</tt> because you are moving above the Music directory and so need to include the full pathname.</li>
</ol>
<p><strong>In a pathname, the tilde character (</strong><tt><strong>~</strong></tt><strong>) indicates that you are in your Home directory. In the previous step, you could have just entered </strong><tt><strong>cd ~</strong></tt><strong> to move back into your Home directory.</strong></p>
<p>Command: <tt>ls</tt></p>
<p>Options: <tt>-F</tt> differentiates between files and directories; <tt>-l</tt> shows full information for all the files in the directory</p>
<p>What it does: Lists the contents of a directory in various formats and with various information</p>
<p><strong>Note that while most commands and options are in lowercase, they aren&#8217;t always. For example, the </strong><tt><strong>-F</strong></tt><strong> option is different from the </strong><tt><strong>-f</strong></tt><strong> option (both are valid for the </strong><tt><strong>ls</strong></tt><strong> command).</strong></p>
<ol>
<li>Use the <tt>cd</tt> command to move into the directory of which you want to see the contents.</li>
<li>Type <tt>ls</tt>. You will see a multiple-column view of the directory; files and directories are listed by name.</li>
<li>Type <tt>ls -F</tt>. You will see the same list as before except that now directories are indicated by a <tt>/</tt> after their names.</li>
<li>Type <tt>ls -l</tt>. You will see the contents of the directory listed along with plenty of information about each file and directory within the current directory. If there are many items, the information will scroll so quickly that you might not be able to see all of it. This is a good opportunity to see an example of piping two commands together.</li>
<li>Type <tt>ls -l | more</tt>. This time, the same list will appear, but the display will stop when the screen is full and you will see the <tt>more</tt> prompt at the bottom of the window. Press the spacebar to see the next screenful of information. You can also scroll the window using the scrollbars to see all the items in the window.</li>
</ol>
<p><strong>If you type the command </strong><tt><strong>ls –la</strong></tt><strong>, you will also see the invisible files in a directory.</strong></p>
<p>The permissions string you see at the start of each item in the full listing indicates how the item can be accessed. The first character indicates whether the item is a file (<tt>-</tt>) or a directory (<tt>d</tt>). The next three characters indicate what the owner of the file can do; <tt>r</tt> is for read, <tt>w</tt> is for write, and <tt>x</tt> is for execute. If any of these characters is the hyphen (<tt>-</tt>), that action can&#8217;t be taken. The next three characters indicate the permission that the group has to the file. For example, if these characters are <tt>r-x</tt>, that would mean that other members of the group can read, not write, and execute the file. The last three characters indicate what everyone else can do.</p>
<p>The execute permission applies to a directory. In order to access a directory, you must have both read and execute permission. If you also have <tt>w</tt> permission, you can change the contents of the directory as well.</p>
<p>Command: <tt>file</tt> <tt>filename</tt></p>
<p>What it does: Indicates what kind of file <tt>filename</tt> is</p>
<p><strong>Type </strong><tt><strong>file</strong></tt><strong>, followed by the filename you would like information about, and press Return. Information about the file will be displayed.</strong></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li>March 12, 2010 -- <a href="http://www.techbuzzing.com/2010/03/windows-7-disable-memory-dump-files-and-save-hdd-space/" title="Windows 7: Disable Memory Dump Files and Save HDD Space">Windows 7: Disable Memory Dump Files and Save HDD Space</a> (0)</li><li>February 12, 2010 -- <a href="http://www.techbuzzing.com/2010/02/windows-7-automatically-delete-temporary-files/" title="Windows 7: Automatically Delete Temporary Files ">Windows 7: Automatically Delete Temporary Files </a> (1)</li><li>February 1, 2010 -- <a href="http://www.techbuzzing.com/2010/02/windows-7-geographic-location/" title="Windows 7: Geographic Location ">Windows 7: Geographic Location </a> (1)</li><li>January 14, 2010 -- <a href="http://www.techbuzzing.com/2010/01/windows-7-create-a-system-recovery-disc/" title="Windows 7: Create a System Recovery Disc ">Windows 7: Create a System Recovery Disc </a> (1)</li><li>January 7, 2010 -- <a href="http://www.techbuzzing.com/2010/01/mac-changing-the-clock-display/" title="MAC: Changing the Clock Display">MAC: Changing the Clock Display</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.techbuzzing.com/2009/12/unix-viewing-the-contents-of-directories/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
