background preloader

Linux/Unix

Facebook Twitter

Linux Shell Scripting Tutorial - A Beginner's handbook. Unix / Linux Bourne / Bash Shell Scripting Tutorial [ steve-parker.org ] UNIX Basics : Examples with awk: A short introduction. Examples with awk: A short introduction Abstract: This article gives some insight in to the tricks that you can do with AWK.

UNIX Basics : Examples with awk: A short introduction

It is not a tutorial but it provides real live examples to use. Originally, the idea to write this text came to me after reading a couple of articles published in LinuxFocus that were written by Guido Socher. One of them, about find and related commands, showed me that I was not the only one who used the command line. The key question is whether this awk command is really useful. Introduction to awk My first news about AWK are old enough for being forgotten. Easy, isn't it? Once we have learned the lesson on how to extract a column we can do things such as renaming files (append .new to "files_list"): ... and more: As you can see, AWK really helps when the same calculations are repeated over and over ... and apart from that it is much more fun to write an AWK program than doing almost the same thing 20 times manually. Awk is powerful.

Useful awk one-liners. <em>pattern matching and processing </em> <strong>awk 'pattern {action}' filename </strong> reads one line at a time from file, checks for pattern match, performs action if pattern matched <em>pattern</em> NR is a special awk variable meaning the line number of the current record.

Useful awk one-liners

Sed1line. Test (Unix) Test expression or [ expression ] The following functions are used to construct this parameter: -e FileName - FileName exists.

test (Unix)

Note: All remaining functions return true if the object (file or string) exists, and the condition specified is true. UnixBareMn.pdf (application/pdf Object) Norman Matloff's Unix and Linux Tutorial. More Unix commands. Job Control on UNIX systems. Hard Links and Symbolic Links. 17.

Hard Links and Symbolic Links

Hard Links and Symbolic Links Today we're going to test your virtual imagination ability! You're probably familiar with shortcuts in Microsoft Windows or aliases on the Mac. Linux has something, or actually some things similar, called hard links and symbolic links. Symbolic links (also called symlinks or softlinks) most resemble Windows shortcuts. They contain a pathname to a target file. 1. So far this is probably a bit tough to grasp, but stick around, we're going to explain it. IMPORTANT: The tips in this document require the use of command-line commands. Hardlinks Let's do a little experiment to demonstrate the case. . $ mkdir Test $ cd Test Then make a file called FileA: $ vi FileA Press the I key to enter Insert mode: i Then type in some funny lines of text (like "Why did the chicken cross the road? ") Esc ZZ So, you made a file called FileA in a new directory called "Test" in your /home. . $ ln FileA FileB Then use the "i" argument to list the inodes for both FileA and its hardlink.

. $ ls. Hard links and Soft links. As was mentioned in the section on file system structure, every file has a data structure (record) known as an i-node that stores information about the file, and the filename is simply used as a reference to that data structure.

Hard links and Soft links

A is simply a way to refer to the contents of a file. There are two types of links: : a hard link is a pointer to the file's i-node. But what are the differences between the two types of links, in practice? Let us look at an example that highlights these differences. . % ls ./ ../ a-file.txt b-file.txt Let us first add another symbolic link using the option: % ln -s a-file.txt Symbolicb-file.txt % ls -F ./ ../ a-file.txt b-file.txt Symbolicb-file.txt@ A symbolic link, that displays with a @ symbol, has been added to the directory. Terminal - the Find command. Wednesday, 06 August 2008 16:47 For simple searches you need provide nothing more than a directory to start searching: find $HOME This is a bit basic :-) it finds everything in your Home directory.

Terminal - the Find command

But we can be a bit more selective: find $HOME -name "*.tif" This command searches your Home directory for any files whose names end with ".tif". If you want to find all the files that don't end with ".tif", you can do this: Tutorial for chmod. VIM Keyboard Shortcuts. VIM 101: a quick-and-dirty guide to our favorite free file editor. In the world of text editors, there's a plethora of options out there.

VIM 101: a quick-and-dirty guide to our favorite free file editor

If you've ever Googled "how to edit HTML sites" or some such, you know what we mean. Allow us, then, to introduce you to VIM, a free website editor that offers many of the same features as Adobe Dreamweaver, and runs on just about every desktop platform. Specifically, it comes by default on the vast majority of Linux distributions, OS X and commercial Unix systems. (It's available to install on Windows, too.) And did we mention it's free? Getting started If you're running OS X or Linux, start out by opening a terminal. LINUX. Linux OS. Linux Links.