<?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>The journalist programmer &#187; programming</title>
	<atom:link href="http://pauloquerido.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://pauloquerido.com</link>
	<description>A dialog about database journalism, link journalism, network journalism, openness and its skills, methods &#38; resources</description>
	<lastBuildDate>Wed, 21 Dec 2011 18:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The essential *nix commands</title>
		<link>http://pauloquerido.com/bits/the-essential-nix-commands/</link>
		<comments>http://pauloquerido.com/bits/the-essential-nix-commands/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 01:58:55 +0000</pubDate>
		<dc:creator>Paulo Querido</dc:creator>
				<category><![CDATA[bits]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[*nix]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://pauloquerido.com/?p=15</guid>
		<description><![CDATA[I discovered The 15 Essential UNIX commands written almost 5 years ago by Pete Freitag. In 2005 talking to journalists in *nix commands was a bit of a daunting. But nowadays they are more known: much more journalists and media guys run Linux servers or Macs with OS X. First read Pete&#8217;s choice, then mine: [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-16" title="crontab" src="http://cdn.querido.pt/com/2010/03/crontab.jpg" alt="" width="236" height="187" />I discovered <a href="http://www.petefreitag.com/item/426.cfm">The 15 Essential UNIX commands</a> written almost 5 years ago by <a href="http://www.petefreitag.com/item/426.cfm">Pete Freitag</a>.</p>
<p>In 2005 talking to journalists in *nix commands was a bit of a daunting. But nowadays they are more known: much more journalists and media guys run Linux servers or Macs with OS X.</p>
<p>First read Pete&#8217;s choice, then mine:</p>
<blockquote><p>1. man &#8211; show manual for a command, example: man ls hit q to exit the man page.<br />
2. cd &#8211; change directory, example: cd /etc/<br />
3. ls &#8211; list directory, similar to dir on windows. example: ls /etc, use ls -l /etc to see more detail<br />
4. cp &#8211; copy a file or directory, example: cp source dest if you want to copy a directory use the -R option for recursive: cp -R /source /dest<br />
5. mv &#8211; move a file, example: mv source dest<br />
6. rm &#8211; remove a file, example: rm somefile to remove a directory you may need the -R option, you can also use the -f option which tells it not to confirm each file: rm -Rf /dir<br />
7. cat &#8211; concatenate, or output a file cat /var/log/messages<br />
8. more &#8211; outputs one page of a file and pauses. example: more /var/log/messages press q to exit before getting to the bottom. You can also pipe to more | more from other commands, for example ls -l /etc | more<br />
9. scp &#8211; secure copy, copies a file over SSH to another server. example: scp /local/file user@host.com:/path/to/save/file<br />
10. tar &#8211; tape archiver, tar takes a bunch of files, and munges them into one .tar file, the files are often compressed with the gzip algorithm, and use the .tar.gz extension. to create a tar tar -cf archive.tar /directory, then to extract the archive to the current directory run tar -xf archive.tar to use gzip, just add a z to the options, to create a tar.gz: tar -czf archive.tar.gz /dir to extract it tar -xzf archive.tar.gz<br />
11. grep &#8211; pattern matcher, grep takes a regular expression, or to match a simple string you can use fast grep, fgrep failure /var/log/messages, I&#8217;m usually just looking for a simple pattern so I tend to use fgrep more than regular grep.<br />
12. find &#8211; lists files and directories recursively on a single line, I usually pipe grep into the mix when I use find, eg: find / | fgrep log<br />
13. tail &#8211; prints the last few lines of a file, this is handy for checking log files tail /var/log/messages if you need see more lines, use the -n option, tail -n 50 /var/log/messages you can also use the -f option, which will continuously show you the end of the file as things are added to it (very handy for watching logs) tail -f /var/log/messages<br />
14. head &#8211; same as tail, but shows the first few lines the file<br />
15. vi &#8211; text editor, there are several text editors such as emacs, and nano, but vi is usually installed on any server so its a good one to learn. To edit a file type vi file to edit a line press Esc i then to save changes and exit use Esc wq, or to quit without saving use Esc q!. There are a million other commands, but that will enable you to edit files at a basic level.</p></blockquote>
<h3>I&#8217;m a vi guy</h3>
<p>I use cd, ls (with some customization via .bashrc), cp, rm, scp, grep, tail &#8212; and of course vi. I&#8217;m a vi guy. Even on my MacBook, where I usually write in a registered TextMate text and code editor, sometimes it is easier to edit with vi. I use it in a very simple way, I don&#8217;t know most of its commands and functions (nobody does).</p>
<p>My adds:<br />
w &#8211; displays  information about  the users currently on the machine, and their processes. Useful.<br />
top &#8211; provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. When you need to debug a server this command is essential.<br />
ps &#8211; report a snapshot of the current processes. I use it with ax and some pipelines to quickly  get precise info (like: ps ax | grep httpd | wc -l to see how many Apache processes are runing).<br />
crontab &#8211; cron is a time-based job scheduler and crontab is the configuration file that specifies shell commands to run periodically on a given schedule. I run a bunch of scripts (PHP and bash, mostly) and crontab is *the* way to organize the scheduling and other aspects, like logging and mail-logging their outputs. Repetitive tasks, like pulling a RSS feed and do things with it, are performed by scripts orchestrated within crontab.</p>
<div class="wpbuzzer_button" style="float: left"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://pauloquerido.com/bits/the-essential-nix-commands/" data-imageurl=""></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://pauloquerido.com/bits/the-essential-nix-commands/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: pauloquerido.com @ 2012-05-17 16:03:25 -->
