linux-unix

recent posts related to linux and unix

New, free Introduction to Unix and Linux tutorial

After having this on my "wish list" for many years, I finally took the time tonight to regenerate the pages for my "Free Introduction to Unix and Linux tutorial". The old format was just horrible, spread out among 285 small pages, and while this one still needs some work, it's about 1,000 times better than the old format, and comes in weighing only 13 large tutorial pages.

Some of the tutorial material is a little dated now, but these sections are still very relevant to today's Unix/Linux world:

Use the Linux sed command to delete a range of lines

In a previous blog post I demonstrated how to use sed to insert text before or after a line in many files, and in this example I'd like to demonstrate how to delete a range of lines using sed.

sed delete - How to delete a range of lines using sed

The problem I had today was that I just re-generated 99 HTML files for my Introduction to Unix/Linux tutorial using Latex2HTML, and it generates a bunch of "junk" in my HTML files that looks like this:

sed example - insert text before and after existing lines

If you ever need to use the Unix/Linux sed command to insert text before or after a line of text in an existing file, here's how I just ran several sed commands to update my old Function Point Analysis tutorial to have a format that doesn't look like it was created in the 1990s.

This tutorial consists of over 40 files, and I had eight changes I wanted to make each file. So I had two choices: modify each file by hand over the next six hours, or run a series of sed commands and be done in 30 minutes. (I chose the sed commands.)

How to create a symbolic link in Linux

Linux FAQ: How do I create a symbolic link in Linux?

Answer: To create a symbolic link in Linux, just use the Linux ln command, like this:

ln -s OriginalFile NewSymbolicFile

As you can see from my filenames, when using the Linux ln command, you specify the name of the file you're linking to first, and then supply the name of the link second.

Bash shell script - how to prompt and read user input

Unix/Linux bash shell script FAQ: How do I prompt a user for input from a shell script (Bash shell script), and then read the input the user provides?

Answer: I usually use the shell script "read" function to read input from a shell script. Here are two slightly different versions of the same shell script. This first version prompts the user for input only once, and then dies if the user doesn't give a correst Y/N answer:

New release of the Teleport command

Quick note: I just released Version 0.3 of my Teleport command. If you haven't heard of it before, the Teleport command is the Linux/Unix cd command, with a memory. Because it has a memory, you can do many cool things, such as "teleport" from one directory to another, list the history of directories you've visited before, jump to directories with partial names, etc. I think it's pretty cool, and I hope you'll check it out. It's free, and released under the GNU GPL.

Move vi/vim editor temporary swap and backup files to another directory

vi/vim FAQ: I keep getting these vim swap/temporary/backup files in my current directory, the ones with the tilde (~) character at the end of the filename; how do I get these swap/temporary files to go into another directory?

vi/vim video tutorials

Woo-hoo, I've always wanted to create a vim video tutorial series, and now that I have the software to do it, I'm finally embarking on this adventure.

My vi/vim editor video tutorial - Lesson
1, Introduction

A Linux mail command tip

If you're ever working on a Unix or Linux system, and need to email a file to someone else, it may be helpful to know that you can send your email message right from the Unix command line. You don't need to hop into mutt or any other Unix or Linux mail client to email the file.

Use zgrep to grep a gzip (gz) file

Linux zgrep FAQ: How do I use the Linux zgrep command? (Or, How do I grep a GZ file?)

Linux users quickly learn how to use the Linux grep command on plain text files, but it takes a little longer to really you can grep gzip (gz) files as well. Here's how.

Problem - Want to grep gzip files

You want to grep a text file that has been compressed with gzip. You typically use the following steps to grep a gzip'd file, but you know there must be a better way:

Syndicate content