Sable Cantus
Musician, Dad, Gamer, Teacher, Explorer, Philosopher, Runner, Student of the world
view my profile
sync your files
go for a run
let's meet
Posts
- September 07, 11:48 AM
-
September 04, 01:21 PM
Buzz by Sable Cantus from Buzz
Only in America.Only in America. -
September 03, 06:09 PM
Buzz by Sable Cantus from posterous.com
tempests of uncertainty and bravado:
Teenagers are teenagers -- tempests of uncertainty and bravado -- no matter what zip code they live in.
via andrewsullivan.theatlantic.com
love this quote. great read. it reaches me as a part-time college professortempests of uncertainty and bravado:
Teenagers are teenagers -- tempests of uncertainty and bravado -- no matter what zip code they live in.
via andrewsullivan.theatlantic.com
love this quote. great read. it reaches me as a part-time college professor -
August 30, 09:58 PM
Buzz by Sable Cantus from Mobile
Life can be strange. I just met with an instrument repair guy at a bar in Fullerton. Bruce Belo was highly recommended to me to get my slaughtered trombone slide repaired after a horrible child plus brass accident.
I literally left my prize conn 44h with a complete stranger in a bar. I'll call him tomorrow I hope!Life can be strange. I just met with an instrument repair guy at a bar in Fullerton. Bruce Belo was highly recommended to me to get my slaughtered trombone slide repaired after a horrible child plus brass accident.
I literally left my prize conn 44h with a complete stranger in a bar. I'll call him tomorrow I hope! -
August 31, 10:35 PM
Buzz by Sable Cantus from posterous.com
Bruce belo and I:Bruce belo and I: -
August 31, 04:30 PM
Buzz by Sable Cantus from posterous.com
India Blackberry | Research in Motion | Ban:
Under the agreement, RIM will immediately implement systems to grant "lawful access by law enforcement agencies" to customer data, India's Home Ministry said in a statement.
via globalpost.com
This article makes it seem as though the government of India will be able to read blackberry users email. I don't think that is possible as email is encrypted from the device all the way to the server at the network operations center. For an enterprise like ours, email is encrypted all the way to our BES. For a non enterprise user, their email is encrypted all the way to RIM headquarters.
I suppose that RIM could hand over the unencrypted email headers of messages so it would be possible to see that I sent an email to so-and-so.
Messenger data is another story. Anyone can decrypt or change ( http://www.blackberryfaq.com/index.php/How_do_I_alter/remove_the_peer-to-peer... it.India Blackberry | Research in Motion | Ban:
Under the agreement, RIM will immediately implement systems to grant "lawful access by law enforcement agencies" to customer data, India's Home Ministry said in a statement.
via globalpost.com
This article makes it seem as though the government of India will be able to read blackberry users email. I don't think that is possible as email is encrypted from the device all the way to the server at the network operations center. For an enterprise like ours, email is encrypted all the way to our BES. For a non enterprise user, their email is encrypted all the way to RIM headquarters.
I suppose that RIM could hand over the unencrypted email headers of messages so it would be possible to see that I sent an email to so-and-so.
Messenger data is another story. Anyone can decrypt or change ( http://www.blackberryfaq.com/index.php/How_do_I_alter/remove_the_peer-to-peer... it. -
August 31, 02:14 PM
Buzz by Sable Cantus from Google Reader
new cli-style commands to effectively route through your daily news feed.
I say huzzah
Fullscreen and more! - Official Google Reader Blognew cli-style commands to effectively route through your daily news feed.
I say huzzah
Fullscreen and more! - Official Google Reader Blog -
August 25, 11:50 AM
Buzz by Sable Cantus from posterous.com
US-CERT Cyber Security Tip ST05-014 -- Real-World Warnings Keep You Safe Online:
If it sounds too good to be true, it probably is
via us-cert.gov
This list of solid security tidbits came via email this morning and I thought I would share with you. via us-cert.govUS-CERT Cyber Security Tip ST05-014 -- Real-World Warnings Keep You Safe Online:
If it sounds too good to be true, it probably is
via us-cert.gov
This list of solid security tidbits came via email this morning and I thought I would share with you. via us-cert.gov -
August 24, 01:14 PM
Buzz by Sable Cantus from posterous.com
UNIX tips: Learn 10 good UNIX usage habits:
Introduction
When you use a system often, you tend to fall into set usage patterns. Sometimes, you do not start the habit of doing things in the best possible way. Sometimes, you even pick up bad practices that lead to clutter and clumsiness. One of the best ways to correct such inadequacies is to conscientiously pick up good habits that counteract them. This article suggests 10 UNIX command-line habits worth picking up -- good habits that help you break many common usage foibles and make you more productive at the command line in the process. Each habit is described in more detail following the list of good habits.
Adopt 10 good habits
Ten good habits to adopt are:
Make directory trees in a single swipe .
Change the path; do not move the archive .
Combine your commands with control operators .
Quote variables with caution .
Use escape sequences to manage long input .
Group your commands together in a list .
Use xargs outside of find
.
Know when grep should do the counting -- and when it
should step aside .
Match certain fields in output, not just lines .
Stop piping cat s .
Make directory trees in a single swipe
Listing 1 illustrates one of the most common bad UNIX habits around: defining directory trees one at a time.
Listing 1. Example of bad habit #1: Defining directory trees individually
It is so much quicker to use thep option to mkdir and make all parent directories along with theirthat is what the
children in a single command. But even administrators who know about this option are still caught stepping through the subdirectories as they make them on the
command line. It is worth your time to conscientiously pick up the good habit:
Listing 2. Example of good habit #1: Defining directory trees with one command
You can use this option to make entire complex directory trees, which are great to use inside scripts; not just simple hierarchies. For example:
Listing 3. Another example of good habit #1: Defining complex directory trees with one command
In the past, the only excuse to define directories individually was that your mkdir implementation did not support this option, but this is no longer true on most systems. IBM AIX® mkdir , GNU mkdir , and others that conform to the Single UNIX Specification now have this option.
For the few systems that still lack the capability, use the mkdirhier script (see Resources ), which is a wrapper for mkdir that does the same function:
Change the path; do not move the archive
Another bad usage pattern is moving a .tar archive file to a certain directory because it happens to be the directory you want to extract it in. You never need to
do this. You can unpack any .tar archive file into any directory you like -C option is for. Use the -C option when unpacking an archive file to specify the directory to unpack it in:especially if the archive file belongs somewhere else.
Listing 4. Example of good habit #2: Using option -C to unpack a .tar archive file
Making a habit of using -C is preferable to moving the archive file to where you want to unpack it, changing to that directory, and only then extracting its contents -
Back to top Combine your commands with control operators
You probably already know that in most shells, you can combine commands on a single command line by placing a semicolon (;) between them. The semicolon is a shell control operator , and while it is useful for stringing together multiple discrete commands on a single command line, it does not work for everything. For example, suppose you use a semicolon to combine two commands in which the proper execution of the second command depends entirely upon the successful completion of the first. If the first command does not exit as you expected, the second command still runs -- and fails. Instead, use more appropriate control operators (some are described in this article). As long as your shell supports them, they are worth getting into the habit of using them.
Run a command only if another command returns a zero exit status
Use the && control operator to combine two commands so that the second is run only if the first command returns a
zero exit status. In other words, if the first command runs successfully, the second command runs. If the first command fails, the second command does not run at all. For example:
Listing 5. Example of good habit #3: Combining commands with control operators
In this example, the contents of the archive are extracted into the ~/tmp/a/b/c directory unless that directory does not exist. If the directory does not exist, the
tar command does not run, so nothing is extracted.
Run a command only if another command returns a non-zero exit status
Similarly, the || control operator separates two commands and runs the second command only if the first command returns a non-zero exit status. In other words, if the first command is successful, the second command does not run. If the first command fails, the second command
does run. This operator is often used when testing for whether a given directory exists and, if not, it creates one:
Listing 6. Another example of good habit #3: Combining commands with control operators
You can also combine the control operators described in this section. Each works on the last command run:
Listing 7. A combined example of good habit #3: Combining commands with control operators
Back to top Quote variables with caution
Always be careful with shell expansion and variable names. It is generally a good idea to enclose variable calls in double quotation marks, unless you have a good reason not to. Similarly, if you are directly following a variable name with alphanumeric text, be sure also to enclose the variable name in curly braces ({}) to
distinguish it from the surrounding text. Otherwise, the shell interprets the trailing text as part of your variable name -- and most likely returns a null value. Listing 8 provides examples of various quotation and non-quotation of variables and their effects.
Listing 8. Example of good habit #4: Quoting (and not quoting) a variable
Back to top Use escape sequences to manage long input
You have probably seen code examples in which a backslash (\) continues a long line over to the next line, and you know that most shells treat what you type over successive lines joined by a backslash as one long line. However, you might not take advantage of this function on the command line as often as you can. The backslash is especially handy if your terminal does not handle multi-line wrapping properly or when your command line is smaller than usual (such as when
you have a long path on the prompt). The backslash is also useful for making sense of long input lines as you type them, as in the following example:
Listing 9. Example of good habit #5: Using a backslash for long input
Alternatively, the following configuration also works:
Listing 10. Alternative example of good habit #5: Using a backslash for long input
However you divide an input line over multiple lines, the shell always treats it as one continuous line, because it always strips out all the backslashes and extra
spaces.
Note: In most shells, when you press the up arrow key, the entire multi-line entry is redrawn on a single, long input line.
Back to top Group your commands together in a list
Most shells have ways to group a set of commands together in a list so that you can pass their sum-total output down a pipeline or otherwise redirect any or all of its streams to the same place. You can generally do this by running a list of commands in a subshell or by running a list of commands in the current shell.
Run a list of commands in a subshell
Use parentheses to enclose a list of commands in a single group. Doing so runs the commands in a new subshell and allows you to redirect or otherwise
collect the output of the whole, as in the following example:
Listing 11. Example of good habit #6: Running a list of commands in a subshell
In this example, the content of the archive is extracted in the tmp/a/b/c/ directory while the output of the grouped commands, including a list of extracted files, is mailed to the admin address.
The use of a subshell is preferable in cases when you are redefining environment variables in your list of commands and you do not want those definitions to
apply to your current shell.
Run a list of commands in the current shell
Use curly braces ({}) to enclose a list of commands to run in the current shell. Make sure you include spaces between the braces and the actual commands, or the shell might not interpret the braces correctly. Also, make sure that the final command in your list ends with a semicolon, as in the following example:
Listing 12. Another example of good habit #6: Running a list of commands in the current shell
Back to top Use xargs outside of find
Use the xargs tool as a filter for making good use of output culled from the find command. The general precept is that a find run provides a list of files that match some criteria. This list is passed on to xargs , which then runs some other useful command with that list of files as arguments, as in the following example:
Listing 13. Example of the classic use of the xargs tool
However, do not think of xargs as just a helper for find ; it is one of those underutilized tools that, when
you get into the habit of using it, you want to try on everything, including the following uses.
Passing a space-delimited list
In its simplest invocation, xargs is like a filter that takes as input a list (with each member on a single line). The tool puts those members on a single space-delimited line:
Listing 14. Example of output from the xargs tool
You can send the output of any tool that outputs file names through xargs to get a list of arguments for some other tool that takes file names as an argument, as in the following example:
Listing 15. Example of using of the xargs tool
The xargs command is useful for more than passing file names. Use it any time you need to filter text into a single line:
Listing 16. Example of good habit #7: Using the xargs tool to filter text into a single line
Be cautious using xargs
Technically, a rare situation occurs in which you could get into trouble using xargs . By default, the end-of-file string is an underscore (_); if that character is sent as a single input argument, everything after it is ignored. As a precaution against this, use thee flag, which, without arguments, turns off the end-of-file string completely.and when it should step aside
Back to top Know when grep should do the counting -
Avoid piping a grep to wcl in order to count the number of lines of output. The -c option to grep gives a count of lines that match the specified pattern and is generally faster than a pipe to wc , as in the following example:and if that is what you are looking for, that is great. But in cases where lines can have multiple instances of a particular pattern, these methods do not give you a true count of the actual number of instances matched. To count the number of instances, use wc to count, after all. First, run a grep command with the -o option, if your version supports it. This option outputs only the matched pattern, one on each line, and not the line itself. But you cannot use it in conjunction with the -c option, so use wc -l to count the lines, as in the following example:
Listing 17. Example of good habit #8: Counting lines with and without grep
An addition to the speed factor, the -c option is also a better way to do the counting. With multiple files, grep with the -c option returns a separate count for each file, one on each line, whereas a pipe to wc gives a total count for all files combined.
However, regardless of speed considerations, this example showcases another common error to avoid. These counting methods only give counts of the number of lines containing matched patterns -
Listing 18. Example of good habit #8: Counting pattern instances with grep
In this case, a call to wc is slightly faster than a second call to grep with a dummy pattern put in to match and count each line (such as grep -c ).
Back to top Match certain fields in output, not just lines
A tool like awk is preferable to grep when you want to match the pattern in only a specific field in the lines of output and not just anywhere in the lines.
The following simplified example shows how to list only those files modified in December:
Listing 19. Example of bad habit #9: Using grep to find patterns in specific fields
In this example, grep filters the lines, outputting all files with Dec in their modification dates as well as in their names. Therefore, a file such as December_Report.pdf is matched, even if it has not been modified since January. This probably is not what you want. To match a pattern in a particular field, it is better to use awk , where a relational operator matches the exact field, as in the following example:
Listing 20. Example of good habit #9: Using awk to find patterns in specific fields
See Resources for more details about how to use awk .
Back to top Stop piping cats
A basic-but-common grep usage error involves piping the output of cat to grep to search the contents of a single file. This is absolutely unnecessary and a waste of time, because tools such as grep take file names as arguments. You simply do not need to use cat in this situation at all, as in the following example:
Listing 21. Example of good and bad habit #10: Using grep with and without cat
This mistake applies to many tools. Because most tools take standard input as an argument using a hyphen (-), even the argument for using cat to intersperse multiple files with stdin is often not valid. It is really only necessary to concatenate first before a pipe when you use cat with one of its several filtering options.
Back to top Conclusion: Embrace good habits
It is good to examine your command-line habits for any bad usage patterns. Bad habits slow you down and often lead to unexpected errors. This article presents 10 new habits that can help you break away from many of the most common usage errors. Picking up these good habits is a positive step toward sharpening your UNIX command-line skills.
Resources Learn
" Use free software within commercial UNIX " (developerWorks, February 2006) is a short primer on using the myriad of open source software on a commercial, proprietary UNIX implementation.
" Working in the bash shell " (developerWorks, May 2006) provides an introductory tutorial on the popular Bash shell.
" Get started with GAWK " (developerWorks, September 2006) shows you how to manipulate text with the AWK language.
" Hone your regexp pattern-building skills " (developerWorks, July 2006) describes more useful ways to use grep .
Visit the developerWorks AIX and UNIX zone to get the resources you need to advance your skills.
New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.
Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
To obtain a copy of mkdirhier , you can download a version from the Haskell compiler .
Discuss
Podcasts : Tune in and catch up with IBM technical experts.
Check out developerWorks blogs and get involved in the developerWorks community .
About the author Michael Stutz is author of The Linux® Cookbook , which, incidentally, he designed and typeset using only open source software. His research interests include digital publishing and the future of the book. He has used various UNIX operating systems for 20 years. You can reach Michael at stutz@dsl.org .
Comments
10 comments | Sign in Add comment Report inappropriate content Show 5 most recent comments | Show next 5 comments | Show all comments Sign in Add comment
Back to top
Trademarks | My developerWorks terms and conditions
Close [x]
Help: Update or add to My dW interests
What's this?
This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.
And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.
View your My developerWorks profile
Return from help
Close [x]
Help: Remove from My dW interests
What's this?
Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.
View your My developerWorks profile
Return from help
via ibm.com
Thanks IBM for helping us streamline our cli workflow.UNIX tips: Learn 10 good UNIX usage habits:
Introduction
When you use a system often, you tend to fall into set usage patterns. Sometimes, you do not start the habit of doing things in the best possible way. Sometimes, you even pick up bad practices that lead to clutter and clumsiness. One of the best ways to correct such inadequacies is to conscientiously pick up good habits that counteract them. This article suggests 10 UNIX command-line habits worth picking up -- good habits that help you break many common usage foibles and make you more productive at the command line in the process. Each habit is described in more detail following the list of good habits.
Adopt 10 good habits
Ten good habits to adopt are:
Make directory trees in a single swipe .
Change the path; do not move the archive .
Combine your commands with control operators .
Quote variables with caution .
Use escape sequences to manage long input .
Group your commands together in a list .
Use xargs outside of find
.
Know when grep should do the counting -- and when it
should step aside .
Match certain fields in output, not just lines .
Stop piping cat s .
Make directory trees in a single swipe
Listing 1 illustrates one of the most common bad UNIX habits around: defining directory trees one at a time.
Listing 1. Example of bad habit #1: Defining directory trees individually
It is so much quicker to use thep option to mkdir and make all parent directories along with theirthat is what the
children in a single command. But even administrators who know about this option are still caught stepping through the subdirectories as they make them on the
command line. It is worth your time to conscientiously pick up the good habit:
Listing 2. Example of good habit #1: Defining directory trees with one command
You can use this option to make entire complex directory trees, which are great to use inside scripts; not just simple hierarchies. For example:
Listing 3. Another example of good habit #1: Defining complex directory trees with one command
In the past, the only excuse to define directories individually was that your mkdir implementation did not support this option, but this is no longer true on most systems. IBM AIX® mkdir , GNU mkdir , and others that conform to the Single UNIX Specification now have this option.
For the few systems that still lack the capability, use the mkdirhier script (see Resources ), which is a wrapper for mkdir that does the same function:
Change the path; do not move the archive
Another bad usage pattern is moving a .tar archive file to a certain directory because it happens to be the directory you want to extract it in. You never need to
do this. You can unpack any .tar archive file into any directory you like -C option is for. Use the -C option when unpacking an archive file to specify the directory to unpack it in:especially if the archive file belongs somewhere else.
Listing 4. Example of good habit #2: Using option -C to unpack a .tar archive file
Making a habit of using -C is preferable to moving the archive file to where you want to unpack it, changing to that directory, and only then extracting its contents -
Back to top Combine your commands with control operators
You probably already know that in most shells, you can combine commands on a single command line by placing a semicolon (;) between them. The semicolon is a shell control operator , and while it is useful for stringing together multiple discrete commands on a single command line, it does not work for everything. For example, suppose you use a semicolon to combine two commands in which the proper execution of the second command depends entirely upon the successful completion of the first. If the first command does not exit as you expected, the second command still runs -- and fails. Instead, use more appropriate control operators (some are described in this article). As long as your shell supports them, they are worth getting into the habit of using them.
Run a command only if another command returns a zero exit status
Use the && control operator to combine two commands so that the second is run only if the first command returns a
zero exit status. In other words, if the first command runs successfully, the second command runs. If the first command fails, the second command does not run at all. For example:
Listing 5. Example of good habit #3: Combining commands with control operators
In this example, the contents of the archive are extracted into the ~/tmp/a/b/c directory unless that directory does not exist. If the directory does not exist, the
tar command does not run, so nothing is extracted.
Run a command only if another command returns a non-zero exit status
Similarly, the || control operator separates two commands and runs the second command only if the first command returns a non-zero exit status. In other words, if the first command is successful, the second command does not run. If the first command fails, the second command
does run. This operator is often used when testing for whether a given directory exists and, if not, it creates one:
Listing 6. Another example of good habit #3: Combining commands with control operators
You can also combine the control operators described in this section. Each works on the last command run:
Listing 7. A combined example of good habit #3: Combining commands with control operators
Back to top Quote variables with caution
Always be careful with shell expansion and variable names. It is generally a good idea to enclose variable calls in double quotation marks, unless you have a good reason not to. Similarly, if you are directly following a variable name with alphanumeric text, be sure also to enclose the variable name in curly braces ({}) to
distinguish it from the surrounding text. Otherwise, the shell interprets the trailing text as part of your variable name -- and most likely returns a null value. Listing 8 provides examples of various quotation and non-quotation of variables and their effects.
Listing 8. Example of good habit #4: Quoting (and not quoting) a variable
Back to top Use escape sequences to manage long input
You have probably seen code examples in which a backslash (\) continues a long line over to the next line, and you know that most shells treat what you type over successive lines joined by a backslash as one long line. However, you might not take advantage of this function on the command line as often as you can. The backslash is especially handy if your terminal does not handle multi-line wrapping properly or when your command line is smaller than usual (such as when
you have a long path on the prompt). The backslash is also useful for making sense of long input lines as you type them, as in the following example:
Listing 9. Example of good habit #5: Using a backslash for long input
Alternatively, the following configuration also works:
Listing 10. Alternative example of good habit #5: Using a backslash for long input
However you divide an input line over multiple lines, the shell always treats it as one continuous line, because it always strips out all the backslashes and extra
spaces.
Note: In most shells, when you press the up arrow key, the entire multi-line entry is redrawn on a single, long input line.
Back to top Group your commands together in a list
Most shells have ways to group a set of commands together in a list so that you can pass their sum-total output down a pipeline or otherwise redirect any or all of its streams to the same place. You can generally do this by running a list of commands in a subshell or by running a list of commands in the current shell.
Run a list of commands in a subshell
Use parentheses to enclose a list of commands in a single group. Doing so runs the commands in a new subshell and allows you to redirect or otherwise
collect the output of the whole, as in the following example:
Listing 11. Example of good habit #6: Running a list of commands in a subshell
In this example, the content of the archive is extracted in the tmp/a/b/c/ directory while the output of the grouped commands, including a list of extracted files, is mailed to the admin address.
The use of a subshell is preferable in cases when you are redefining environment variables in your list of commands and you do not want those definitions to
apply to your current shell.
Run a list of commands in the current shell
Use curly braces ({}) to enclose a list of commands to run in the current shell. Make sure you include spaces between the braces and the actual commands, or the shell might not interpret the braces correctly. Also, make sure that the final command in your list ends with a semicolon, as in the following example:
Listing 12. Another example of good habit #6: Running a list of commands in the current shell
Back to top Use xargs outside of find
Use the xargs tool as a filter for making good use of output culled from the find command. The general precept is that a find run provides a list of files that match some criteria. This list is passed on to xargs , which then runs some other useful command with that list of files as arguments, as in the following example:
Listing 13. Example of the classic use of the xargs tool
However, do not think of xargs as just a helper for find ; it is one of those underutilized tools that, when
you get into the habit of using it, you want to try on everything, including the following uses.
Passing a space-delimited list
In its simplest invocation, xargs is like a filter that takes as input a list (with each member on a single line). The tool puts those members on a single space-delimited line:
Listing 14. Example of output from the xargs tool
You can send the output of any tool that outputs file names through xargs to get a list of arguments for some other tool that takes file names as an argument, as in the following example:
Listing 15. Example of using of the xargs tool
The xargs command is useful for more than passing file names. Use it any time you need to filter text into a single line:
Listing 16. Example of good habit #7: Using the xargs tool to filter text into a single line
Be cautious using xargs
Technically, a rare situation occurs in which you could get into trouble using xargs . By default, the end-of-file string is an underscore (_); if that character is sent as a single input argument, everything after it is ignored. As a precaution against this, use thee flag, which, without arguments, turns off the end-of-file string completely.and when it should step aside
Back to top Know when grep should do the counting -
Avoid piping a grep to wcl in order to count the number of lines of output. The -c option to grep gives a count of lines that match the specified pattern and is generally faster than a pipe to wc , as in the following example:and if that is what you are looking for, that is great. But in cases where lines can have multiple instances of a particular pattern, these methods do not give you a true count of the actual number of instances matched. To count the number of instances, use wc to count, after all. First, run a grep command with the -o option, if your version supports it. This option outputs only the matched pattern, one on each line, and not the line itself. But you cannot use it in conjunction with the -c option, so use wc -l to count the lines, as in the following example:
Listing 17. Example of good habit #8: Counting lines with and without grep
An addition to the speed factor, the -c option is also a better way to do the counting. With multiple files, grep with the -c option returns a separate count for each file, one on each line, whereas a pipe to wc gives a total count for all files combined.
However, regardless of speed considerations, this example showcases another common error to avoid. These counting methods only give counts of the number of lines containing matched patterns -
Listing 18. Example of good habit #8: Counting pattern instances with grep
In this case, a call to wc is slightly faster than a second call to grep with a dummy pattern put in to match and count each line (such as grep -c ).
Back to top Match certain fields in output, not just lines
A tool like awk is preferable to grep when you want to match the pattern in only a specific field in the lines of output and not just anywhere in the lines.
The following simplified example shows how to list only those files modified in December:
Listing 19. Example of bad habit #9: Using grep to find patterns in specific fields
In this example, grep filters the lines, outputting all files with Dec in their modification dates as well as in their names. Therefore, a file such as December_Report.pdf is matched, even if it has not been modified since January. This probably is not what you want. To match a pattern in a particular field, it is better to use awk , where a relational operator matches the exact field, as in the following example:
Listing 20. Example of good habit #9: Using awk to find patterns in specific fields
See Resources for more details about how to use awk .
Back to top Stop piping cats
A basic-but-common grep usage error involves piping the output of cat to grep to search the contents of a single file. This is absolutely unnecessary and a waste of time, because tools such as grep take file names as arguments. You simply do not need to use cat in this situation at all, as in the following example:
Listing 21. Example of good and bad habit #10: Using grep with and without cat
This mistake applies to many tools. Because most tools take standard input as an argument using a hyphen (-), even the argument for using cat to intersperse multiple files with stdin is often not valid. It is really only necessary to concatenate first before a pipe when you use cat with one of its several filtering options.
Back to top Conclusion: Embrace good habits
It is good to examine your command-line habits for any bad usage patterns. Bad habits slow you down and often lead to unexpected errors. This article presents 10 new habits that can help you break away from many of the most common usage errors. Picking up these good habits is a positive step toward sharpening your UNIX command-line skills.
Resources Learn
" Use free software within commercial UNIX " (developerWorks, February 2006) is a short primer on using the myriad of open source software on a commercial, proprietary UNIX implementation.
" Working in the bash shell " (developerWorks, May 2006) provides an introductory tutorial on the popular Bash shell.
" Get started with GAWK " (developerWorks, September 2006) shows you how to manipulate text with the AWK language.
" Hone your regexp pattern-building skills " (developerWorks, July 2006) describes more useful ways to use grep .
Visit the developerWorks AIX and UNIX zone to get the resources you need to advance your skills.
New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.
Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
To obtain a copy of mkdirhier , you can download a version from the Haskell compiler .
Discuss
Podcasts : Tune in and catch up with IBM technical experts.
Check out developerWorks blogs and get involved in the developerWorks community .
About the author Michael Stutz is author of The Linux® Cookbook , which, incidentally, he designed and typeset using only open source software. His research interests include digital publishing and the future of the book. He has used various UNIX operating systems for 20 years. You can reach Michael at stutz@dsl.org .
Comments
10 comments | Sign in Add comment Report inappropriate content Show 5 most recent comments | Show next 5 comments | Show all comments Sign in Add comment
Back to top
Trademarks | My developerWorks terms and conditions
Close [x]
Help: Update or add to My dW interests
What's this?
This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.
And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.
View your My developerWorks profile
Return from help
Close [x]
Help: Remove from My dW interests
What's this?
Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.
View your My developerWorks profile
Return from help
via ibm.com
Thanks IBM for helping us streamline our cli workflow. -
August 23, 12:06 PM
Buzz by Sable Cantus from Google Reader
It must be a terrible crime to drive through L.A. on a family vacation. Avoid it at all costs.
If the police run your plates and the COLOR, MAKE, and MODEL don't match - they won't notice. All they see is that the plates were stolen ...
» National Lampoon’s LA Vacation Dvorak Uncensored: General interest observations and true web-log. - www.dvorak.orgIt must be a terrible crime to drive through L.A. on a family vacation. Avoid it at all costs.
If the police run your plates and the COLOR, MAKE, and MODEL don't match - they won't notice. All they see is that the plates were stolen ...
» National Lampoon’s LA Vacation Dvorak Uncensored: General interest observations and true web-log. - www.dvorak.org -
August 23, 03:43 AM
Buzz by Sable Cantus from posterous.com
Doubletwist using 175% CPU?:
I wonder why DoubeTwist is hitting Safari Ad Block and if that is causing the massive CPU hit?Doubletwist using 175% CPU?:
I wonder why DoubeTwist is hitting Safari Ad Block and if that is causing the massive CPU hit? - August 20, 12:38 PM
-
August 18, 04:28 PM
Buzz by Sable Cantus from Mobile
You know you are overscheduled when you need shared calendars and collaboration software to do stuff with your wife!You know you are overscheduled when you need shared calendars and collaboration software to do stuff with your wife! -
August 18, 12:05 PM
Buzz by Sable Cantus from Google Reader
This is awesome. Imagine how many of these you could fit into a laptop, mobile phone, tablet, car stereo, or pair of sneakers.
SanDisk 64GB postage stamp-sized iSSDs are going to make devices smaller via #FeedSquares - FeedSquaresThis is awesome. Imagine how many of these you could fit into a laptop, mobile phone, tablet, car stereo, or pair of sneakers.
SanDisk 64GB postage stamp-sized iSSDs are going to make devices smaller via #FeedSquares - FeedSquares -
August 15, 02:01 AM
Buzz by Sable Cantus from Mobile
market://details?id=com.audible.application: Audible for Android 1.0 Launched -- Now available for download in Android Market.market://details?id=com.audible.application: Audible for Android 1.0 Launched -- Now available for download in Android Market. -
August 11, 05:55 PM
Buzz by Sable Cantus from posterous.com
"this should not be happening":
The mozilla thunderbird guys have a sense of humour :D The syslog error says, "this should not be happening! arrgggggh!""this should not be happening":
The mozilla thunderbird guys have a sense of humour :D The syslog error says, "this should not be happening! arrgggggh!" -
August 11, 01:00 AM
Buzz by Sable Cantus from posterous.com
girl quits job on dry erase board exposes farmville boss called her hopa theCHIVE:
via thechive.com
Whether this is real or fake Jenny has some talent. Very creative and entertaining.girl quits job on dry erase board exposes farmville boss called her hopa theCHIVE:
via thechive.com
Whether this is real or fake Jenny has some talent. Very creative and entertaining. -
August 10, 04:19 PM
Buzz by Sable Cantus from posterous.com
Don’t Be Ugly By Accident! « OkTrends:
via blog.okcupid.com
iPhone users have more sex? I guess it would have been worth it to defect to AT&T!!!Don’t Be Ugly By Accident! « OkTrends:
via blog.okcupid.com
iPhone users have more sex? I guess it would have been worth it to defect to AT&T!!! -
August 10, 03:02 AM
Buzz by Sable Cantus from posterous.com
thumbs up with the one-eyed flip cam:
DSC_3201thumbs up with the one-eyed flip cam:
DSC_3201 - August 09, 01:06 PM
-
August 09, 12:32 PM
Buzz by Sable Cantus from Google Reader
Let me get this straight. Coca-cola said that the general public couldn't possibly be led to believe that vitaminwater was healthy? It's just sugarwater? The kids have an expression for this sort of forehead smacking nonsense: fml
John Robbins: The Dark Side of Vitaminwater - www.huffingtonpost.comLet me get this straight. Coca-cola said that the general public couldn't possibly be led to believe that vitaminwater was healthy? It's just sugarwater? The kids have an expression for this sort of forehead smacking nonsense: fml
John Robbins: The Dark Side of Vitaminwater - www.huffingtonpost.com -
August 05, 09:32 AM
Buzz by Sable Cantus from Mobile
"...and they don't have degrees in computer science"
http://online.wsj.com/article/SB10001424052748704017904575409093226146722.html"...and they don't have degrees in computer science"
http://online.wsj.com/article/SB10001424052748704017904575409093226146722.html -
August 04, 02:00 PM
Buzz by Sable Cantus from Google Reader
nice homepage refresh for the Go2Girls
Generated feed for "http://yourgotogirls.com/" - http://yourgotogirls.com/ Google feednice homepage refresh for the Go2Girls
Generated feed for "http://yourgotogirls.com/" - http://yourgotogirls.com/ Google feed -
August 02, 12:29 PM
Buzz by Sable Cantus from Google Reader
Wow. Awesome. I would like to do this for my kids. Maybe a dedicated DSLR with a wifi card that uploads automatically to twitter???
mental_floss Blog » He Took a Polaroid Every Day, Until the Day He Died - www.mentalfloss.comWow. Awesome. I would like to do this for my kids. Maybe a dedicated DSLR with a wifi card that uploads automatically to twitter???
mental_floss Blog » He Took a Polaroid Every Day, Until the Day He Died - www.mentalfloss.com - August 02, 11:52 AM
-
July 23, 04:58 PM
Buzz by Sable Cantus from Buzz
I just saw the "Download Chrome OS" option in the latest parallels update (5.0.9370). This feature may have occurred earlier but I just noticed it today. So I download Chrome. Log in. Install Last Pass. I'm fully up and running inside the Chrome OS VM. Wow.I just saw the "Download Chrome OS" option in the latest parallels update (5.0.9370). This feature may have occurred earlier but I just noticed it today. So I download Chrome. Log in. Install Last Pass. I'm fully up and running inside the Chrome OS VM. Wow. - July 23, 12:38 PM
-
July 23, 12:32 PM
Buzz by Sable Cantus from Google Reader
I'll take two of these. Unless shipping costs are out-of-hand :)
India's $35 tablet computer - Roger Ebert's Journal - blogs.suntimes.comI'll take two of these. Unless shipping costs are out-of-hand :)
India's $35 tablet computer - Roger Ebert's Journal - blogs.suntimes.com -
July 23, 12:30 PM
Buzz by Sable Cantus from Google Reader
Of course they underestimated the time it was going to take to implement a large IT migration in a complex (both politically and technically) and physically disparate organization.
duh.
Google misses deadline in high-profile L.A. deal - MarketWatch - www.marketwatch.comOf course they underestimated the time it was going to take to implement a large IT migration in a complex (both politically and technically) and physically disparate organization.
duh.
Google misses deadline in high-profile L.A. deal - MarketWatch - www.marketwatch.com -
July 23, 12:10 PM
Buzz by Sable Cantus from Buzz
Does anyone else find that there buzz feed is a little slow to scroll in Safari 5 but not in Chrome? (on Mac)Does anyone else find that there buzz feed is a little slow to scroll in Safari 5 but not in Chrome? (on Mac) -
July 21, 02:24 PM
Buzz by Sable Cantus from Google Reader
Go forth and secure your passwords.
LastPass Gets the Green Light from Security Now!'s Steve Gibson via #FeedSquares - FeedSquaresGo forth and secure your passwords.
LastPass Gets the Green Light from Security Now!'s Steve Gibson via #FeedSquares - FeedSquares -
July 13, 09:34 PM
Buzz by Sable Cantus from Mobile
Busy pizza night ... wonder whyBusy pizza night ... wonder why - July 13, 09:26 PM
-
July 12, 01:32 PM
Buzz by Sable Cantus from Posted from the web
Cool and timelyCool and timely - July 02, 01:03 PM
-
July 02, 12:47 PM
Buzz by Sable Cantus from Buzz
Our DSL internet connection is out at the moment.
So I'm posting this on my MacBook Pro, tethered via wifi to my Froyo-powered Nexus One on T-Mobile.
Next stop? I'm off to amazon.com to pre-order the new Kindle DX.
@John Gruber is soooo going to love this one.Our DSL internet connection is out at the moment.
So I'm posting this on my MacBook Pro, tethered via wifi to my Froyo-powered Nexus One on T-Mobile.
Next stop? I'm off to amazon.com to pre-order the new Kindle DX.
@John Gruber is soooo going to love this one. - July 01, 12:21 PM
-
June 29, 03:37 PM
Buzz by Sable Cantus from Mobile
I would worry that my house would be "violated" if I hired them...I would worry that my house would be "violated" if I hired them... -
June 28, 11:19 AM
Buzz by Sable Cantus from Buzz
Does checking email shorten your lifespan? - Diagnosis: Email Apnea? - O'Reilly Radar http://is.gd/d7LmxDoes checking email shorten your lifespan? - Diagnosis: Email Apnea? - O'Reilly Radar http://is.gd/d7Lmx -
June 26, 08:14 PM
Buzz by Sable Cantus from Mobile
Sitting down for dinner at the harbor houseSitting down for dinner at the harbor house -
June 25, 12:46 PM
Buzz by Sable Cantus from Google Reader
I love these hacked in real life things ...
The Droid You’re Looking For - Hacked IRL- Culture Jamming GraffitiI love these hacked in real life things ...
The Droid You’re Looking For - Hacked IRL- Culture Jamming Graffiti -
June 24, 09:47 AM
Buzz by Sable Cantus from Posted via buzz@gmail
Speedtest.net Android ResultSpeedtest.net Android Result -
June 19, 01:58 AM
Buzz by Sable Cantus from Mobile
Just played a rockin 70s setJust played a rockin 70s set -
June 16, 12:29 PM
Buzz by Sable Cantus from Mobile
No fast T-Mobile 3g+ at CSLA. It is still decent but at about 900k down according to speedtest.No fast T-Mobile 3g+ at CSLA. It is still decent but at about 900k down according to speedtest. -
June 15, 03:34 PM
Buzz by Sable Cantus from Mobile
Grammer fail?Grammer fail? -
June 15, 04:29 PM
Buzz by Sable Cantus from Google Reader
"Which is the fundamental paradox of mobile – so long as the mobile carriers remain a part of mobile computing, it will only work for so long as you don't go anywhere."
The mobile revolution has arrived | Technology | guardian.co.uk - www.guardian.co.uk"Which is the fundamental paradox of mobile – so long as the mobile carriers remain a part of mobile computing, it will only work for so long as you don't go anywhere."
The mobile revolution has arrived | Technology | guardian.co.uk - www.guardian.co.uk -
June 15, 11:31 AM
Buzz by Sable Cantus from Google Reader
The new Mac mini is out and has a native HDMI port. Anybody interested in plugging this into their TV? I sure am.
Mac mini - Buy Mac mini desktop computers - Apple Store (U.S.) - store.apple.comThe new Mac mini is out and has a native HDMI port. Anybody interested in plugging this into their TV? I sure am.
Mac mini - Buy Mac mini desktop computers - Apple Store (U.S.) - store.apple.com -
June 14, 01:17 PM
Buzz by Sable Cantus from Mobile
Ever have that feeling that you are a nail in one hand,a hammer in the other, and just can't get them to work together?Ever have that feeling that you are a nail in one hand,a hammer in the other, and just can't get them to work together? -
June 14, 12:19 PM
Buzz by Sable Cantus from Buzz
LIfehacker disappeared on me this morning.LIfehacker disappeared on me this morning. -
June 14, 11:51 AM
Buzz by Sable Cantus from Google Reader
The picture of all the tech guys in funky robes looks like something out of Eyes Wide Shut ...
Microsoft Kinect gets official, Video Chat announced -- Engadget - www.engadget.comThe picture of all the tech guys in funky robes looks like something out of Eyes Wide Shut ...
Microsoft Kinect gets official, Video Chat announced -- Engadget - www.engadget.com -
June 11, 12:25 PM
Buzz by Sable Cantus from Mobile
I just discovered a nice little froyo feature. Long press on the Smiley icon on the keyboard and a menu of Smileys pops up. Long press on the period and get a menu of punctuation. That's a time saver.I just discovered a nice little froyo feature. Long press on the Smiley icon on the keyboard and a menu of Smileys pops up. Long press on the period and get a menu of punctuation. That's a time saver. -
June 09, 02:28 PM
Buzz by Sable Cantus from Google Reader
This is an extension waiting to happen ...
Modify the look of the Safari 5 Reader function - Mac OS X Hints - www.macosxhints.comThis is an extension waiting to happen ...
Modify the look of the Safari 5 Reader function - Mac OS X Hints - www.macosxhints.com -
June 09, 02:19 PM
Buzz by Sable Cantus from Buzz
I couldn't see a way to add this photo to the other post so here is a picture of the Nexus One on it's kickstand at my desk. (Pic taken with a blackberry 9700).
The pic of the stand is here: http://www.google.com/buzz/jcantus/Y2isL6aWJVR/Nexus-one-kickstand-This-sits-on-my-desk-justI couldn't see a way to add this photo to the other post so here is a picture of the Nexus One on it's kickstand at my desk. (Pic taken with a blackberry 9700).
The pic of the stand is here: http://www.google.com/buzz/jcantus/Y2isL6aWJVR/Nexus-one-kickstand-This-sits-on-my-desk-just -
June 09, 02:13 PM
Buzz by Sable Cantus from Mobile
Nexus one kickstand
This sits on my desk just below my monitor. The nexus one sits landscaped perfectly angled for me to see anything on screen.Nexus one kickstand
This sits on my desk just below my monitor. The nexus one sits landscaped perfectly angled for me to see anything on screen. -
June 09, 12:28 PM
Buzz by Sable Cantus from Buzz
Let's come back to reality everyone. The Safari 5 reader view does not block ad's, it does not kill revenue, it does not break the web.
It simply allows the reader (me) to pull the article out of the page I have already opened. I have already seen the advertisements. Now I don't have to worry about wonky fonts or flashing lights distracting me from the reason I visited the page - to read the article.
One issue that we have as web-surfers is that our attention is drawn in so many directions that we miss a lot of the depth of what we are looking at. Have you ever skimmed an article and then forgotten what it was about? Have you ever started reading a story and then followed a link or a video only to forget where you were?Let's come back to reality everyone. The Safari 5 reader view does not block ad's, it does not kill revenue, it does not break the web.
It simply allows the reader (me) to pull the article out of the page I have already opened. I have already seen the advertisements. Now I don't have to worry about wonky fonts or flashing lights distracting me from the reason I visited the page - to read the article.
One issue that we have as web-surfers is that our attention is drawn in so many directions that we miss a lot of the depth of what we are looking at. Have you ever skimmed an article and then forgotten what it was about? Have you ever started reading a story and then followed a link or a video only to forget where you were? -
June 08, 01:19 PM
Buzz by Sable Cantus from Google Reader
Safari 5 and Instapaper will help us avoid this ...
Author Nicholas Carr: The Web Shatters Focus, Rewires Brains | Magazine - www.wired.comSafari 5 and Instapaper will help us avoid this ...
Author Nicholas Carr: The Web Shatters Focus, Rewires Brains | Magazine - www.wired.com - June 08, 12:32 PM
-
June 08, 12:18 PM
Buzz by Sable Cantus from Google Reader
As a Nexus One user I agree. I am also impressed by the new phone and would like one. It's not that much better than my Nexus One though to make me want to drop a bunch of money or switch carriers.
Now if FaceTime works with other Android phones for video chat I will want to get a front facing camera....
Also, is the iPhone 4 going to be sold unlocked? With quad band can I use it on my T-Mobile 3G network?
An Android User’s Take On Yesterday’s iPhone News - techcrunch.comAs a Nexus One user I agree. I am also impressed by the new phone and would like one. It's not that much better than my Nexus One though to make me want to drop a bunch of money or switch carriers.
Now if FaceTime works with other Android phones for video chat I will want to get a front facing camera....
Also, is the iPhone 4 going to be sold unlocked? With quad band can I use it on my T-Mobile 3G network?
An Android User’s Take On Yesterday’s iPhone News - techcrunch.com -
June 08, 12:02 PM
Buzz by Sable Cantus from tweetdeck.com
Safari 5: To quickly enter Reader mode, hit CMD+SHIFT+R. It's amazing how nice this feature is when it's built in.Safari 5: To quickly enter Reader mode, hit CMD+SHIFT+R. It's amazing how nice this feature is when it's built in. -
June 07, 03:30 PM
Buzz by Sable Cantus from Posted from the web
Apple announces new iPhone 4: the Steve Jobs keynoteApple announces new iPhone 4: the Steve Jobs keynote - June 04, 09:41 PM
-
June 03, 03:46 PM
Buzz by Sable Cantus from Mobile
Apple screen-gasm at my desk today.Apple screen-gasm at my desk today. -
June 02, 05:04 PM
Buzz by Sable Cantus from tweetdeck.com
Do you really speak the same language as your boss? It may sound like a technicial, specific question, but what is the boss really asking?Do you really speak the same language as your boss? It may sound like a technicial, specific question, but what is the boss really asking? - June 02, 02:15 PM
-
June 01, 02:14 PM
Buzz by Sable Cantus from Google Reader
This tip is wonderful and addresses that little nagging thing ...
Prevent Disk Space size info truncation on the Finder Desktop - OS X Daily - osxdaily.comThis tip is wonderful and addresses that little nagging thing ...
Prevent Disk Space size info truncation on the Finder Desktop - OS X Daily - osxdaily.com -
June 01, 02:07 PM
Buzz by Sable Cantus from tweetdeck.com
Why aren't you writing more music? Writing more charts? My excuses are usually "I'm tired, I've had a long day, or It's just not the right time". Isn't the only way to get better at writing music to write music? Like my drill sgt used to say, "want to get better at pushups? practice pushups"Why aren't you writing more music? Writing more charts? My excuses are usually "I'm tired, I've had a long day, or It's just not the right time". Isn't the only way to get better at writing music to write music? Like my drill sgt used to say, "want to get better at pushups? practice pushups" -
May 28, 03:05 PM
Buzz by Sable Cantus from Google Maps for mobile
No lines at sb todayNo lines at sb today -
May 28, 11:54 AM
Buzz by Sable Cantus from Google Reader
This makes a lot of sense. For $99 I would order it right now, sight unseen.
Yes I'm an apple lover.
The next Apple TV revealed: cloud storage and iPhone OS on tap... and a $99 price tag -- Engadget - www.engadget.comThis makes a lot of sense. For $99 I would order it right now, sight unseen.
Yes I'm an apple lover.
The next Apple TV revealed: cloud storage and iPhone OS on tap... and a $99 price tag -- Engadget - www.engadget.com -
May 28, 11:37 AM
Buzz by Sable Cantus from Google Reader
We can't really expect a profit-centered organization to have our best interests at heart.
Facebook and the Ford Pinto - Steve (GRC) Gibson's BlogWe can't really expect a profit-centered organization to have our best interests at heart.
Facebook and the Ford Pinto - Steve (GRC) Gibson's Blog -
May 27, 10:43 PM
Buzz by Sable Cantus from Mobile
Big meeting ... will drama ensue? Stay tuned.Big meeting ... will drama ensue? Stay tuned. -
May 27, 06:35 PM
Buzz by Sable Cantus from Mobile
Cool looking sport trike on the freewayCool looking sport trike on the freeway -
May 27, 11:32 AM
Buzz by Sable Cantus from tweetdeck.com
I've already installed Gist for android. First real use coming up for a 10am meeting. http://tinyurl.com/32z7epjI've already installed Gist for android. First real use coming up for a 10am meeting. http://tinyurl.com/32z7epj -
May 27, 12:36 AM
Buzz by Sable Cantus from Mobile
Graduation dinnerGraduation dinner - May 26, 12:05 PM
-
May 25, 01:19 PM
Buzz by Sable Cantus from tweetdeck.com
buzz is live on tweetdeck on my desktop. Tweetdeck would not install the desktop client via Chrome though. I had to open Safari.buzz is live on tweetdeck on my desktop. Tweetdeck would not install the desktop client via Chrome though. I had to open Safari. -
May 24, 03:54 PM
Buzz by Sable Cantus from Mobile
Google voice notifications are green on the trackball .. how cool
So far I haven't seen any other color lighted trackball notifications ...Google voice notifications are green on the trackball .. how cool
So far I haven't seen any other color lighted trackball notifications ... -
May 24, 02:36 PM
Buzz by Sable Cantus from Buzz
A quick search for "Android 2.2" which was just announced a few days ago is showing 17,600,000 results - wowA quick search for "Android 2.2" which was just announced a few days ago is showing 17,600,000 results - wow -
May 23, 01:42 AM
Buzz by Sable Cantus from Mobile
Battlestar galactica game going on right nowBattlestar galactica game going on right now -
May 24, 12:14 PM
Buzz by Sable Cantus from Google Reader
This feature absolutely kicks arse - the send to phone button works.
Froyo Feature: How to use the Google Chrome to Phone Extension | Android Central - www.androidcentral.comThis feature absolutely kicks arse - the send to phone button works.
Froyo Feature: How to use the Google Chrome to Phone Extension | Android Central - www.androidcentral.com -
May 24, 04:02 AM
Buzz by Sable Cantus from Mobile
Froyo is up and running. Having gmail and exchange Cal's side by side I'd sweet.
The keyboard is more responsive too.Froyo is up and running. Having gmail and exchange Cal's side by side I'd sweet.
The keyboard is more responsive too. - May 21, 09:14 PM
-
May 21, 01:15 PM
Buzz by Sable Cantus from Buzz
I love that google talk replies go to my N1, ichat, and open browsers simultaneously ...I love that google talk replies go to my N1, ichat, and open browsers simultaneously ... -
May 21, 01:02 PM
Buzz by Sable Cantus from Buzz
"It turns out that on the internet, people use flash."
http://www.youtube.com/user/GoogleDevelopers#p/c/CF01A789E62F2454/1/dBQFXRW5ZiE"It turns out that on the internet, people use flash."
http://www.youtube.com/user/GoogleDevelopers#p/c/CF01A789E62F2454/1/dBQFXRW5ZiE -
May 21, 12:39 PM
Buzz by Sable Cantus from Buzz
"If you believe in choice, if you believe in innovation from everyone, welcome to Android."
http://www.youtube.com/user/GoogleDevelopers"If you believe in choice, if you believe in innovation from everyone, welcome to Android."
http://www.youtube.com/user/GoogleDevelopers -
May 20, 04:12 PM
Buzz by Sable Cantus from Google Reader
I've been dreaming of a way to add an SSD as a second drive in my laptop - lo and behold, here it is!
MCE OptiBay Hard Drive for MacBook Pro, MacBook, PowerBook G4, and Mac mini - www.mcetech.comI've been dreaming of a way to add an SSD as a second drive in my laptop - lo and behold, here it is!
MCE OptiBay Hard Drive for MacBook Pro, MacBook, PowerBook G4, and Mac mini - www.mcetech.com -
May 19, 01:44 PM
Buzz by Sable Cantus from Buzz
Didn't the google I/O presenters plan for the network to be saturated? They should setup a private presenters wifi network next year.Didn't the google I/O presenters plan for the network to be saturated? They should setup a private presenters wifi network next year. -
May 17, 02:41 PM
Buzz by Sable Cantus from Google Reader
These guys loaded a BASIC program into an Apple //e using the audio output to "dial in" via the modem and then ran a dude's ASCII music video ...
I'm so impressed.
Panic Blog » An Apple //e, an iPad, and Jed - www.panic.comThese guys loaded a BASIC program into an Apple //e using the audio output to "dial in" via the modem and then ran a dude's ASCII music video ...
I'm so impressed.
Panic Blog » An Apple //e, an iPad, and Jed - www.panic.com -
May 12, 09:39 AM
Buzz by Sable Cantus from Mobile
I used an ipad last night to control keynote while lecturing. The ipad was on a music stand with some notes. It was very smooth.I used an ipad last night to control keynote while lecturing. The ipad was on a music stand with some notes. It was very smooth. -
May 11, 11:46 AM
Buzz by Sable Cantus from Google Reader
What would a high-fidelity audio track bring to the listener if they are hearing it over low-fi earbuds or in the car with the sound of the road in the background?
A Musical Revolution, With a Cost in Fidelity - NYTimes.com - www.nytimes.comWhat would a high-fidelity audio track bring to the listener if they are hearing it over low-fi earbuds or in the car with the sound of the road in the background?
A Musical Revolution, With a Cost in Fidelity - NYTimes.com - www.nytimes.com -
May 11, 12:59 AM
Buzz by Sable Cantus from Buzz
Show off your buzz feed on your flavors.me homepage by putting this http://buzz.googleapis.com/feeds/{user}/public/posted in the RSS services option. Put your gmail username where it says {user}. Check mine out cantus.usShow off your buzz feed on your flavors.me homepage by putting this http://buzz.googleapis.com/feeds/{user}/public/posted in the RSS services option. Put your gmail username where it says {user}. Check mine out cantus.us -
May 10, 02:02 PM
Buzz by Sable Cantus from Posted from the web
I'm a dork and used to use an older version of visor way back on 10.3. Then I forgot about it. Then I saw my colleague on Ubuntu with his "window shade" terminal and I was jealous. Now I have it again.
What a terrible narrative! If you use terminal all day just use this.I'm a dork and used to use an older version of visor way back on 10.3. Then I forgot about it. Then I saw my colleague on Ubuntu with his "window shade" terminal and I was jealous. Now I have it again.
What a terrible narrative! If you use terminal all day just use this. - May 01, 04:10 PM
-
May 01, 04:09 PM
Buzz by Sable C from Mobile
Who will be at the OC marathon expo today?Who will be at the OC marathon expo today? -
April 19, 01:37 PM
Buzz by Sable C from Buzz
If you are using Spaces on 10.6 and Synergy then the keyboard doesn't seem to sync with synergy on a Windows XP client unless you are on Space #1 ... wierd
The mouse will work fine from any space though ...If you are using Spaces on 10.6 and Synergy then the keyboard doesn't seem to sync with synergy on a Windows XP client unless you are on Space #1 ... wierd
The mouse will work fine from any space though ... -
April 13, 07:44 PM
Buzz by Sable C from Google Reader
I greatly desire this over my old 15" macbook pro.
New MacBook Pro: 10-Hour Battery, Hi-Res Screen, i7 CPU | Gadget Lab | Wired.com - www.wired.comI greatly desire this over my old 15" macbook pro.
New MacBook Pro: 10-Hour Battery, Hi-Res Screen, i7 CPU | Gadget Lab | Wired.com - www.wired.com -
April 13, 07:43 PM
Buzz by Sable C from Google Reader
My wife is being featured on how entrepreneurs can invest in a VA to save time ... cool.
Game Plan For Your Business :: Priceless tips on hiring a Virtual Assistant so you can focus on increasing your bottom line. - www.gameplanforyourbusiness.comMy wife is being featured on how entrepreneurs can invest in a VA to save time ... cool.
Game Plan For Your Business :: Priceless tips on hiring a Virtual Assistant so you can focus on increasing your bottom line. - www.gameplanforyourbusiness.com -
April 13, 11:33 AM
Buzz by Sable C from Buzz
Apps Emulate Life
It's been three years now in the App Economy. Sure we've always had applications on our computers. Programs that we could type in from magazines, trade on disks, or download from numerous websites. In fact, from the time I first started on computers in 1985 I had been moving steadily away from the "App Economy".
See, the App Economy already exists in your home, in your school, and in your library. I still go to the Barnes & Noble to buy an App. In this case, a book, much like an icon on my shelf, that does one thing. I have hundreds of them. Real life icons that do one thing each.
I find it fascinating that I'm able to download app's that are books instead of readers that provide books in a single interface.
But isn't this the argument against compilations?Apps Emulate Life
It's been three years now in the App Economy. Sure we've always had applications on our computers. Programs that we could type in from magazines, trade on disks, or download from numerous websites. In fact, from the time I first started on computers in 1985 I had been moving steadily away from the "App Economy".
See, the App Economy already exists in your home, in your school, and in your library. I still go to the Barnes & Noble to buy an App. In this case, a book, much like an icon on my shelf, that does one thing. I have hundreds of them. Real life icons that do one thing each.
I find it fascinating that I'm able to download app's that are books instead of readers that provide books in a single interface.
But isn't this the argument against compilations? -
April 12, 12:29 PM
Buzz by Sable C from Google Reader
I love when he says "let me call a meeting, cause that's what I do, call meetings all day"
The Case for Ignoring People at Work - Distractions - Lifehacker - lifehacker.comI love when he says "let me call a meeting, cause that's what I do, call meetings all day"
The Case for Ignoring People at Work - Distractions - Lifehacker - lifehacker.com -
April 08, 11:21 PM
Buzz by Sable C from Mobile
I just picked my nexus one car dock.. i must have done something wrong though as my friend said he could barely hear me.I just picked my nexus one car dock.. i must have done something wrong though as my friend said he could barely hear me. -
April 08, 11:59 AM
Buzz by Sable C from Google Reader
Visa knows when you are going to get divorced - so they can dump your credit and hike your rates!
How Visa Predicts Divorce - The Daily Beast - www.thedailybeast.comVisa knows when you are going to get divorced - so they can dump your credit and hike your rates!
How Visa Predicts Divorce - The Daily Beast - www.thedailybeast.com
Posts
-
September 03, 06:08 PM
tempests of uncertainty and bravado
Teenagers are teenagers -- tempests of uncertainty and bravado -- no matter what zip code they live in.
love this quote. great read. it reaches me as a part-time college professor
- August 31, 10:35 PM
-
August 31, 04:30 PM
India Blackberry | Research in Motion | Ban
Under the agreement, RIM will immediately implement systems to grant "lawful access by law enforcement agencies" to customer data, India's Home Ministry said in a statement.
via globalpost.comThis article makes it seem as though the government of India will be able to read blackberry users email. I don't think that is possible as email is encrypted from the device all the way to the server at the network operations center. For an enterprise like ours, email is encrypted all the way to our BES. For a non enterprise user, their email is encrypted all the way to RIM headquarters.
I suppose that RIM could hand over the unencrypted email headers of messages so it would be possible to see that I sent an email to so-and-so.
Messenger data is another story. Anyone can decrypt or change (http://www.blackberryfaq.com/index.php/How_do_I_alter/remove_the_peer-to-peer... it.
-
August 25, 11:49 AM
US-CERT Cyber Security Tip ST05-014 -- Real-World Warnings Keep You Safe Online
If it sounds too good to be true, it probably is
via us-cert.govThis list of solid security tidbits came via email this morning and I thought I would share with you. via us-cert.gov
-
August 24, 01:14 PM
UNIX tips: Learn 10 good UNIX usage habits
When you use a system often, you tend to fall into set usage patterns. Sometimes, you do not start the habit of doing things in the best possible way. Sometimes, you even pick up bad practices that lead to clutter and clumsiness. One of the best ways to correct such inadequacies is to conscientiously pick up good habits that counteract them. This article suggests 10 UNIX command-line habits worth picking up -- good habits that help you break many common usage foibles and make you more productive at the command line in the process. Each habit is described in more detail following the list of good habits.
Ten good habits to adopt are:
- Make directory trees in a single swipe.
- Change the path; do not move the archive.
- Combine your commands with control operators.
- Quote variables with caution.
- Use escape sequences to manage long input.
- Group your commands together in a list.
-
Use
xargsoutside offind. -
Know when
grepshould do the counting -- and when it should step aside. - Match certain fields in output, not just lines.
-
Stop piping
cats.
Make directory trees in a single swipe
Listing 1 illustrates one of the most common bad UNIX habits around: defining directory trees one at a time.
Listing 1. Example of bad habit #1: Defining directory trees individually~ $ mkdir tmp ~ $ cd tmp ~/tmp $ mkdir a ~/tmp $ cd a ~/tmp/a $ mkdir b ~/tmp/a $ cd b ~/tmp/a/b/ $ mkdir c ~/tmp/a/b/ $ cd c ~/tmp/a/b/c $
It is so much quicker to use the
-poption tomkdirand make all parent directories along with their children in a single command. But even administrators who know about this option are still caught stepping through the subdirectories as they make them on the command line. It is worth your time to conscientiously pick up the good habit:
Listing 2. Example of good habit #1: Defining directory trees with one command~ $ mkdir -p tmp/a/b/c
You can use this option to make entire complex directory trees, which are great to use inside scripts; not just simple hierarchies. For example:
Listing 3. Another example of good habit #1: Defining complex directory trees with one command~ $ mkdir -p project/{lib/ext,bin,src,doc/{html,info,pdf},demo/stat/a}
In the past, the only excuse to define directories individually was that your
mkdirimplementation did not support this option, but this is no longer true on most systems. IBM AIX®mkdir, GNUmkdir, and others that conform to the Single UNIX Specification now have this option.For the few systems that still lack the capability, use the
mkdirhierscript (see Resources), which is a wrapper formkdirthat does the same function:~ $ mkdirhier project/{lib/ext,bin,src,doc/{html,info,pdf},demo/stat/a}
Change the path; do not move the archive
Another bad usage pattern is moving a .tar archive file to a certain directory because it happens to be the directory you want to extract it in. You never need to do this. You can unpack any .tar archive file into any directory you like -- that is what the
-Coption is for. Use the-Coption when unpacking an archive file to specify the directory to unpack it in:
Listing 4. Example of good habit #2: Using option-Cto unpack a .tar archive file~ $ tar xvf -C tmp/a/b/c newarc.tar.gz
Making a habit of using
-Cis preferable to moving the archive file to where you want to unpack it, changing to that directory, and only then extracting its contents -- especially if the archive file belongs somewhere else.Combine your commands with control operators
You probably already know that in most shells, you can combine commands on a single command line by placing a semicolon (;) between them. The semicolon is a shell control operator, and while it is useful for stringing together multiple discrete commands on a single command line, it does not work for everything. For example, suppose you use a semicolon to combine two commands in which the proper execution of the second command depends entirely upon the successful completion of the first. If the first command does not exit as you expected, the second command still runs -- and fails. Instead, use more appropriate control operators (some are described in this article). As long as your shell supports them, they are worth getting into the habit of using them.
Run a command only if another command returns a zero exit status
Use the
&&control operator to combine two commands so that the second is run only if the first command returns a zero exit status. In other words, if the first command runs successfully, the second command runs. If the first command fails, the second command does not run at all. For example:
Listing 5. Example of good habit #3: Combining commands with control operators~ $ cd tmp/a/b/c && tar xvf ~/archive.tar
In this example, the contents of the archive are extracted into the ~/tmp/a/b/c directory unless that directory does not exist. If the directory does not exist, the
tarcommand does not run, so nothing is extracted.Run a command only if another command returns a non-zero exit status
Similarly, the
||control operator separates two commands and runs the second command only if the first command returns a non-zero exit status. In other words, if the first command is successful, the second command does not run. If the first command fails, the second command does run. This operator is often used when testing for whether a given directory exists and, if not, it creates one:
Listing 6. Another example of good habit #3: Combining commands with control operators~ $ cd tmp/a/b/c || mkdir -p tmp/a/b/c
You can also combine the control operators described in this section. Each works on the last command run:
Listing 7. A combined example of good habit #3: Combining commands with control operators~ $ cd tmp/a/b/c || mkdir -p tmp/a/b/c && tar xvf -C tmp/a/b/c ~/archive.tar
Always be careful with shell expansion and variable names. It is generally a good idea to enclose variable calls in double quotation marks, unless you have a good reason not to. Similarly, if you are directly following a variable name with alphanumeric text, be sure also to enclose the variable name in curly braces ({}) to distinguish it from the surrounding text. Otherwise, the shell interprets the trailing text as part of your variable name -- and most likely returns a null value. Listing 8 provides examples of various quotation and non-quotation of variables and their effects.
Listing 8. Example of good habit #4: Quoting (and not quoting) a variable~ $ ls tmp/ a b ~ $ VAR="tmp/*" ~ $ echo $VAR tmp/a tmp/b ~ $ echo "$VAR" tmp/* ~ $ echo $VARa ~ $ echo "$VARa" ~ $ echo "${VAR}a" tmp/*a ~ $ echo ${VAR}a tmp/a ~ $
Use escape sequences to manage long input
You have probably seen code examples in which a backslash (\) continues a long line over to the next line, and you know that most shells treat what you type over successive lines joined by a backslash as one long line. However, you might not take advantage of this function on the command line as often as you can. The backslash is especially handy if your terminal does not handle multi-line wrapping properly or when your command line is smaller than usual (such as when you have a long path on the prompt). The backslash is also useful for making sense of long input lines as you type them, as in the following example:
Listing 9. Example of good habit #5: Using a backslash for long input~ $ cd tmp/a/b/c || \ > mkdir -p tmp/a/b/c && \ > tar xvf -C tmp/a/b/c ~/archive.tar
Alternatively, the following configuration also works:
Listing 10. Alternative example of good habit #5: Using a backslash for long input~ $ cd tmp/a/b/c \ > || \ > mkdir -p tmp/a/b/c \ > && \ > tar xvf -C tmp/a/b/c ~/archive.tar
However you divide an input line over multiple lines, the shell always treats it as one continuous line, because it always strips out all the backslashes and extra spaces.
Note: In most shells, when you press the up arrow key, the entire multi-line entry is redrawn on a single, long input line.
Group your commands together in a list
Most shells have ways to group a set of commands together in a list so that you can pass their sum-total output down a pipeline or otherwise redirect any or all of its streams to the same place. You can generally do this by running a list of commands in a subshell or by running a list of commands in the current shell.
Run a list of commands in a subshell
Use parentheses to enclose a list of commands in a single group. Doing so runs the commands in a new subshell and allows you to redirect or otherwise collect the output of the whole, as in the following example:
Listing 11. Example of good habit #6: Running a list of commands in a subshell~ $ ( cd tmp/a/b/c/ || mkdir -p tmp/a/b/c && \ > VAR=$PWD; cd ~; tar xvf -C $VAR archive.tar ) \ > | mailx admin -S "Archive contents"
In this example, the content of the archive is extracted in the tmp/a/b/c/ directory while the output of the grouped commands, including a list of extracted files, is mailed to the
adminaddress.The use of a subshell is preferable in cases when you are redefining environment variables in your list of commands and you do not want those definitions to apply to your current shell.
Run a list of commands in the current shell
Use curly braces ({}) to enclose a list of commands to run in the current shell. Make sure you include spaces between the braces and the actual commands, or the shell might not interpret the braces correctly. Also, make sure that the final command in your list ends with a semicolon, as in the following example:
Listing 12. Another example of good habit #6: Running a list of commands in the current shell~ $ { cp ${VAR}a . && chown -R guest.guest a && \ > tar cvf newarchive.tar a; } | mailx admin -S "New archive"
Use the
xargstool as a filter for making good use of output culled from thefindcommand. The general precept is that afindrun provides a list of files that match some criteria. This list is passed on toxargs, which then runs some other useful command with that list of files as arguments, as in the following example:
Listing 13. Example of the classic use of thexargstool~ $ find some-file-criteria some-file-path | \ > xargs some-great-command-that-needs-filename-arguments
However, do not think of
xargsas just a helper forfind; it is one of those underutilized tools that, when you get into the habit of using it, you want to try on everything, including the following uses.Passing a space-delimited list
In its simplest invocation,
xargsis like a filter that takes as input a list (with each member on a single line). The tool puts those members on a single space-delimited line:
Listing 14. Example of output from thexargstool~ $ xargs a b c Control-D a b c ~ $
You can send the output of any tool that outputs file names through
xargsto get a list of arguments for some other tool that takes file names as an argument, as in the following example:
Listing 15. Example of using of thexargstool~/tmp $ ls -1 | xargs December_Report.pdf README a archive.tar mkdirhier.sh ~/tmp $ ls -1 | xargs file December_Report.pdf: PDF document, version 1.3 README: ASCII text a: directory archive.tar: POSIX tar archive mkdirhier.sh: Bourne shell script text executable ~/tmp $
The
xargscommand is useful for more than passing file names. Use it any time you need to filter text into a single line:
Listing 16. Example of good habit #7: Using thexargstool to filter text into a single line~/tmp $ ls -l | xargs -rw-r--r-- 7 joe joe 12043 Jan 27 20:36 December_Report.pdf -rw-r--r-- 1 \ root root 238 Dec 03 08:19 README drwxr-xr-x 38 joe joe 354082 Nov 02 \ 16:07 a -rw-r--r-- 3 joe joe 5096 Dec 14 14:26 archive.tar -rwxr-xr-x 1 \ joe joe 3239 Sep 30 12:40 mkdirhier.sh ~/tmp $
Technically, a rare situation occurs in which you could get into trouble using
xargs. By default, the end-of-file string is an underscore (_); if that character is sent as a single input argument, everything after it is ignored. As a precaution against this, use the-eflag, which, without arguments, turns off the end-of-file string completely.Know when grep should do the counting -- and when it should step aside
Avoid piping a
greptowc -lin order to count the number of lines of output. The-coption togrepgives a count of lines that match the specified pattern and is generally faster than a pipe towc, as in the following example:
Listing 17. Example of good habit #8: Counting lines with and without grep~ $ time grep and tmp/a/longfile.txt | wc -l 2811 real 0m0.097s user 0m0.006s sys 0m0.032s ~ $ time grep -c and tmp/a/longfile.txt 2811 real 0m0.013s user 0m0.006s sys 0m0.005s ~ $
An addition to the speed factor, the
-coption is also a better way to do the counting. With multiple files,grepwith the-coption returns a separate count for each file, one on each line, whereas a pipe towcgives a total count for all files combined.However, regardless of speed considerations, this example showcases another common error to avoid. These counting methods only give counts of the number of lines containing matched patterns -- and if that is what you are looking for, that is great. But in cases where lines can have multiple instances of a particular pattern, these methods do not give you a true count of the actual number of instances matched. To count the number of instances, use
wcto count, after all. First, run agrepcommand with the-ooption, if your version supports it. This option outputs only the matched pattern, one on each line, and not the line itself. But you cannot use it in conjunction with the-coption, so usewc -lto count the lines, as in the following example:
Listing 18. Example of good habit #8: Counting pattern instances with grep~ $ grep -o and tmp/a/longfile.txt | wc -l 3402 ~ $
In this case, a call to
wcis slightly faster than a second call togrepwith a dummy pattern put in to match and count each line (such asgrep -c).Match certain fields in output, not just lines
A tool like
awkis preferable togrepwhen you want to match the pattern in only a specific field in the lines of output and not just anywhere in the lines.The following simplified example shows how to list only those files modified in December:
Listing 19. Example of bad habit #9: Using grep to find patterns in specific fields~/tmp $ ls -l /tmp/a/b/c | grep Dec -rw-r--r-- 7 joe joe 12043 Jan 27 20:36 December_Report.pdf -rw-r--r-- 1 root root 238 Dec 03 08:19 README -rw-r--r-- 3 joe joe 5096 Dec 14 14:26 archive.tar ~/tmp $
In this example,
grepfilters the lines, outputting all files withDecin their modification dates as well as in their names. Therefore, a file such as December_Report.pdf is matched, even if it has not been modified since January. This probably is not what you want. To match a pattern in a particular field, it is better to useawk, where a relational operator matches the exact field, as in the following example:
Listing 20. Example of good habit #9: Usingawkto find patterns in specific fields~/tmp $ ls -l | awk '$6 == "Dec"' -rw-r--r-- 3 joe joe 5096 Dec 14 14:26 archive.tar -rw-r--r-- 1 root root 238 Dec 03 08:19 README ~/tmp $
See Resources for more details about how to use
awk.A basic-but-common
grepusage error involves piping the output ofcattogrepto search the contents of a single file. This is absolutely unnecessary and a waste of time, because tools such asgreptake file names as arguments. You simply do not need to usecatin this situation at all, as in the following example:
Listing 21. Example of good and bad habit #10: Using grep with and withoutcat~ $ time cat tmp/a/longfile.txt | grep and 2811 real 0m0.015s user 0m0.003s sys 0m0.013s ~ $ time grep and tmp/a/longfile.txt 2811 real 0m0.010s user 0m0.006s sys 0m0.004s ~ $
This mistake applies to many tools. Because most tools take standard input as an argument using a hyphen (-), even the argument for using
catto intersperse multiple files withstdinis often not valid. It is really only necessary to concatenate first before a pipe when you usecatwith one of its several filtering options.Conclusion: Embrace good habits
It is good to examine your command-line habits for any bad usage patterns. Bad habits slow you down and often lead to unexpected errors. This article presents 10 new habits that can help you break away from many of the most common usage errors. Picking up these good habits is a positive step toward sharpening your UNIX command-line skills.
Learn
- "Use free software within commercial UNIX" (developerWorks, February 2006) is a short primer on using the myriad of open source software on a commercial, proprietary UNIX implementation.
- "Working in the bash shell" (developerWorks, May 2006) provides an introductory tutorial on the popular Bash shell.
- "Get started with GAWK" (developerWorks, September 2006) shows you how to manipulate text with the AWK language.
-
"Hone your regexp pattern-building skills" (developerWorks, July 2006) describes more useful ways to use
grep. - Visit the developerWorks AIX and UNIX zone to get the resources you need to advance your skills.
- New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.
- Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
-
To obtain a copy of
mkdirhier, you can download a version from the Haskell compiler.
Discuss
- Podcasts: Tune in and catch up with IBM technical experts.
- Check out developerWorks blogs and get involved in the developerWorks community.
Michael Stutz is author of The Linux® Cookbook, which, incidentally, he designed and typeset using only open source software. His research interests include digital publishing and the future of the book. He has used various UNIX operating systems for 20 years. You can reach Michael at stutz@dsl.org.
10 comments | Add commentReport inappropriate content
Very useful article
Posted by Corehead on 14 August 2010
good article. thank you!
Posted by PeterYim on 23 February 2010
I would add:
Know when to switch to a scripting language such as Python/Ruby/Perl/AWK.Posted by Paddy3118 on 11 February 2010
I take a slight issue with your advice of using xargs for find, find has an argument -exec which is suited exactly for that task, further -exec generally runs faster than xargs in large batches.
Posted by Shawn S on 11 February 2010
Listing 8. Example of good habit #4: Quoting (and not quoting) a variable
~ $ VAR="tmp/*"
~ $ echo ${VAR}a
tmp/aa, isn't it?Posted by dhnair on 21 September 2009
Trademarks | My developerWorks terms and conditions
Help: Update or add to My dW interestsWhat's this?
This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.
And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.
Help: Remove from My dW interestsWhat's this?
Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.
via ibm.comThanks IBM for helping us streamline our cli workflow.
-
August 23, 03:42 AM
Doubletwist using 175% CPU?
I wonder why DoubeTwist is hitting Safari Ad Block and if that is causing the massive CPU hit?
-
August 11, 05:42 PM
"this should not be happening"
The mozilla thunderbird guys have a sense of humour :D The syslog
error says, "this should not be happening! arrgggggh!" -
August 11, 12:59 AM
girl quits job on dry erase board exposes farmville boss called her hopa theCHIVE
via thechive.comWhether this is real or fake Jenny has some talent. Very creative and entertaining.
-
August 10, 04:18 PM
Don’t Be Ugly By Accident! « OkTrends
via blog.okcupid.comiPhone users have more sex? I guess it would have been worth it to defect to AT&T!!!
- August 10, 03:01 AM
-
August 10, 02:32 AM
Encrypt a file with a site certificate's public key using openssl
Objective: Contest continues: Get SSL certificate from 208.109.94.231, encrypt snail address. Post to webserver, tweet url. Prize:http://bit.ly/9YxGoH
Step 1Get the public key. Use openssl s_client to connect to the web server and look around. I saw the text that I wanted so I piped the output through sed to just grab the necessary text and direct it to a file cert.pubThis guy has a good writeup on how to use openssl here: http://www.madboa.com/geek/openssl/Make sure to hit CTRL+D to complete the command and write out to the file. You could optionally leave the stream editor out of it and mouse click, copy, paste.Step 2Make sure the key is correct.Looks good, like I have a cert.Step 3Encrypt the plain text. I needed some syntax help for this. I kept getting hung up on this being a public key and used the -pubkey option with the rsautl. This is the page to lookup rsautl: http://www.openssl.org/docs/apps/rsautl.htmlThis finally worked for me:Then I put the file up on a website and sent out the link. I removed the file once I knew that it had been decrypted.Sable -
August 09, 12:53 PM
plainview : software : the barbarian group
If you ever show off websites to your friends or colleagues you might find yourself in the awkward position of having email, im's, update notifications, etc. popup. This browser is what I have been using to solve that. It's recently been updated.
So if you forgot about, or have never heard about, Plainview - check it out.
-
August 09, 12:30 PM
God's Number is 20
via cube20.orgStarting the week off right. Maybe going to get a rubik's cube. I don't feel so bad anymore that I couldn't always solve the thing when I was eight. It took my entire life-time of CPU cycles and some serious research to solve every position :D
- July 13, 07:37 PM
-
June 29, 01:15 PM
Meta - Hacked IRL- Culture Jamming Graffiti
via hackedirl.com"Stop pointless vandalism" - pointless vandalism on a stop sign
-
June 29, 12:37 PM
expose on my n1 | Flickr - Photo Sharing!
via flickr.comThe Launcher Pro app (http://apps.doubletwist.com/LauncherPro-Beta/-2559534084377068449) is super snappy, has lots of customization options and has expose!
this is a shot of my N1 in expose mode.
- June 25, 01:39 PM
- June 24, 03:00 PM
-
June 22, 12:08 PM
Apple's iOS 4 Explored - AnandTech :: Your Source for Hardware Analysis and News
via anandtech.comAnand has a fantastic and thorough write-up on iOS 4. Worth the read. Works well with Safari reader too - get the whole article as one long page.
-
June 17, 01:40 PM
Using the Posterous Bookmarklet - Posterous Help
via posterous.comThere really is a bookmark for everything.
Note in reader which posts to buzz.
Instapaper.
Post to twitter.
Subscribe in reader.
etc., etc.
Updates
-
@google I love today's doodle :D
-
tempests of uncertainty and bravado http://post.ly/vUwN5 days ago from Posterous
-
@tokerud i.e., artist's can post text and video but not the rest of us .. we can post reviews, ratings, and comments. that will throw some
-
@tokerud It would seem that setting the expectations of Ping is going to be the most difficult cake to cut. It's not FB.
-
@scottsigler nice one ... :D
-
My iTunes Ping profile is http://tinyurl.com/3x9c7g7
-
who needs to go to a concert when the streaming quality is this fantastic #appleevent #coldplay
-
apple tv is what I've been waiting for - let's see the price. this is going in my living room asap #appletv
-
enough demo, let me have at it #itunes10
-
is the new iTunes Ping private by default? that would be the biggest deal for me :D
-
@SoCalVA I'm sold on it.
-
"i live a lot of my life upside down" jobs ... Love the quote
-
The video stream is surprisingly intimate. I can hear people laughing and clapping quietly in my headphones
-
If the new streaming service sound this good I will sign up today
-
The sound quality of the apple live event is fantastic
-
Bruce belo and I http://post.ly/uuI515 days ago from Posterous
-
India Blackberry | Research in Motion | Ban http://post.ly/urKS15 days ago from Posterous
-
I left my trombone with a stranger I met in a bar. http://tinyurl.com/35s4r7c
-
@tperfitt I believe that Han experienced his first non-self centered feeling when he fell in love with leia. That changed him.
-
I always thought it was strange that I needed a physical manual to effectively use software and operating systems. Why aren't they built in?15 days ago from web

