background preloader

Learn UNIX in 10 minutes

Learn UNIX in 10 minutes
Learn UNIX in 10 minutes. Version 1.3 Preface This is something that I had given out to students (CAD user training) in years past. The purpose was to have on one page the basics commands for getting started using the UNIX shell (so that they didn't call me asking what to do the first time someone gave them a tape). This document is copyrighted but freely redistributable under the terms of the GFDL . Send me patches, comments, corrections, about whatever you think is wrong or should be included. Directories:Moving around the file system:Listing directory contents:Changing file permissions and attributesMoving, renaming, and copying files:Viewing and editing files:Shells Environment variablesInteractive HistoryFilename CompletionBash is the way cool shell.

Poderosa Screen, le meilleur ami du geek nomade [via IRC (merci - t'ain j'me rappelle plus qui... davee ? fuzzix ?)]Je cherchais un moyen sous bash de lancer un programme, le couper (ou le mettre en sommeil), puis de le récupérer pour le relancer... sur un autre bash. Jobs Les premières étapes sont relativement connues. Ce qui vient en italique l'est beaucoup moins.Pour "stopper" un processus, c'est connu, il faut faire Ctrl-Z. On peut continuer à bosser dans ce terminal, le processus gelé reste bloqué en attendant soit de mourir (tué par un logout de la console, ou par la commande kill), soit d'être réactivé.En l'occurrence, dans la liste des processus suspendus, monsieur vi a le numéro 1. Ubiquïté limitée Une des contrainte de la petite manip avec jobs, c'est qu'il ne peut manipuler que les processus dans la console "mère" du processus.Imagine que j'ai gêlé un processus dans la console n°1 :$ jobs[1]+ Stopped vi toto.txt Pleins feux sur screen La doc me dit : Bleh? Je lance screen : Dans ce "sur-bash", je lance vi toto.txt Hé hé...

Attach icons to anything with CSS Filed: Sun, Jan 07 2007 under Programming|| Tags: css1 selectors icons css Conditional CSS selectors work only with modern browsers (FireFox 2.0+, Opera 9, and IE7). Of particular note, the techniques described in this article will work with IE7 only if you supply a document type. Thanks to CSS selectors it's possible to attach icons to anything you want just by adding an attribute of your choosing to your HTML. A few days ago, while using stumble-upon, I stumbled on a site which showed how to conditionally append icons to the end of hypertext links using css. This would attach a pdf icon to the right of any hyperlink who's URL ended in '.pdf' like this. This trick makes use of what the official specifications call "attribute selectors". This works with any attribute. Any span which has an id which starts with 'google' will be assigned a green background. The kicker is that the attributes can be made up. The epiphany came when I realized I could do the selection without needing a tag.

10 Awk Tips, Tricks and Pitfalls Hi guys and girls, this is the first guest post on my blog. It's written by Waldner from #awk on FreeNode IRC Network. He works as a sysadmin and does shell scripting as a hobby. Waldner will be happy to take any questions about the article. This article takes a look at ten tips, tricks and pitfalls in Awk programming language. Be idiomatic! Update: Mr. In this paragraph, we give some hints on how to write more idiomatic (and usually shorter and more efficient) awk programs. Suppose one wants to print all the lines in a file that match some pattern (a kind of awk-grep, if you like). awk '{if ($0 ~ /pattern/) print $0}' That works, but there are a number of things to note. The first thing to note is that it is not structured according to the awk's definition of a program, which is condition { actions } Our program can clearly be rewritten using this form, since both the condition and the action are very clear here: awk '$0 ~ /pattern/ {print $0}' awk '/pattern/ {print $0}' awk '/pattern/'

Famous Awk One-Liners Explained I noticed that Eric Wendelin wrote an article "awk is a beautiful tool." In this article he said that it was best to introduce Awk with practical examples. I totally agree with Eric. When I was learning Awk, I first went through Awk - A Tutorial and Introduction by Bruce Barnett, which was full of examples to try out; then I created an Awk cheat sheet to have the language reference in front of me; and finally I went through the famous Awk one-liners (link to .txt file), which were compiled by Eric Pement. This is going to be a three-part article in which I will explain every single one-liner in Mr. Eric Pement's Awk one-liner collection consists of five sections: The first part of the article will explain the first two sections: "File spacing" and "Numbering and calculations." I recommend that you print out my Awk cheat sheet before you proceed. These one-liners work with all versions of awk, such as nawk (AT&T's new awk), gawk (GNU's awk), mawk (Michael Brennan's awk) and oawk (old awk).

Famous Awk One-Liners Explained, Part II This is the second part of a three-part article on the Awk one-liners. This part will explain Awk one-liners for text conversion and substitution. See part one for introduction of the series. "What are these famous Awk one-liners?" If you are intrigued by this article series, I suggest that you subscribe to my posts! Eric Pement's Awk one-liner collection consists of five sections: I recommend that you print out my Awk Cheat Sheet before you proceed. Awesome news: I have written an e-book based on this article series. Grab the local copy of Awk one-liners file here awk1line.txt and let's roll. 3. 21. awk '{ sub(/\r$/,""); print }' This one-liner uses the sub(regex, repl, [string]) function. The one-liner replaces '\r' (CR) character at the end of the line with nothing, i.e., erases CR at the end. 22. awk '{ sub(/$/,"\r"); print }' This one-liner also uses the sub() function. 23. awk 1 This one-liner may work, or it may not. Ps. 24. gawk -v BINMODE="w" '1' tr -d \r 25. 26. 27. 28. 29. 30. 31.

Famous Sed One-Liners Explained Inspired by the success of my "Awk One-Liners Explained" article (30,000 views in first three days), I decided to explain the famous sed one-liners as well. These one-liners, just like the Awk one-liners, are compiled by Eric Pement. You may download them here: sed one-liners (link to .txt file). Most people are only familiar with one particular command of sed, namely the "s" (substitute) comand. s/comand/command/. That is unsatisfactory. Sed has at least 20 different commands for you. My sed learning process was actually identical to Awk learning process. Eric's sed one-liners are divided into several sections: 1. Update: Spanish translation of part one is available! I'll divide this article in 3 parts. Before I start explaining, I want to share the key idea that changed the way I think about sed. Awesome news: I have written an e-book based on this article series. Grab a copy of sed cheat sheet, print it and let's dive into one-liners! 1. 1. sed G This sed one-liner uses the 'G' command.