Note that there are some explanatory texts on larger screens.

plurals
  1. POMost powerful examples of Unix commands or scripts every programmer should know
    text
    copied!<p>There are many things that all programmers should know, but I am particularly interested in the Unix/Linux commands that we should all know. For accomplishing tasks that we may come up against at some point such as <strong>refactoring</strong>, <strong>reporting</strong>, <strong>network updates</strong> etc.</p> <p>The reason I am curious is because having previously worked as a software tester at a software company while I am studying my degree, I noticed that all of developers (who were developing Windows software) had 2 computers.</p> <p>To their left was their Windows XP development machine, and to the right was a Linux box. I think it was Ubuntu. Anyway they told me that they used it because it provided powerful unix operations that Windows couldn't do in their development process.</p> <p>This makes me curious to know, as a software engineer what do you believe are some of the most powerful scripts/commands/uses that you can perform on a Unix/Linux operating system that every programmer should know for solving real world tasks that may not necessarily relate to writing code?</p> <p>We all know what <strong>sed</strong>, <strong>awk</strong> and <strong>grep</strong> do. I am interested in some actual Unix/Linux scripting pieces that have solved a difficult problem for you, so that other programmers may benefit. Please provide your story and source.</p> <p>I am sure there are numerous examples like this that people keep in their '<strong>Scripts</strong>' folder.</p> <p><strong>Update:</strong> People seem to be misinterpreting the question. I am not asking for the names of individual unix commands, rather UNIX code <strong>snippets</strong> that have solved a problem for you.</p> <h2>Best answers from the Community</h2> <hr> <p><strong>Traverse a directory tree and print out paths to any files that match a regular expression:</strong></p> <pre><code>find . -exec grep -l -e 'myregex' {} \; &gt;&gt; outfile.txt </code></pre> <p><strong>Invoke the default editor(Nano/ViM)</strong> </p> <blockquote> <p>(works on most Unix systems including Mac OS X) Default editor is whatever your "<strong>EDITOR</strong>" environment variable is set to. ie: <strong>export EDITOR=/usr/bin/pico</strong> which is located at <strong>~/.profile</strong> under Mac OS X.</p> </blockquote> <pre><code>Ctrl+x Ctrl+e </code></pre> <p><strong>List all running network connections (including which app they belong to)</strong></p> <pre><code>lsof -i -nP </code></pre> <p><strong>Clear the Terminal's search history</strong> (Another of my favourites)</p> <pre><code>history -c </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload