Category:
bash

Command substitution in BASH

by
on
November 7, 2008

BASH has the ability to execute a command string and replace that string with the output of the command. Or to say it another way, the output of a command will replace the command itself. There are 2 ways to accomplish this. The first is to surround the command with backticks or blockquotes. `command` You [...]

Read More
No Comments
bash

Delete a specific line from a text file with sed

by
on
October 26, 2008

At some point you may have the need to remove all lines within a text file that match a certain pattern. Accomplishing this is easy with the sed command. Here is the command format. $ sed -i ‘/PATTERN/ d’ file.txt The ‘-i‘ option allows you to edit the specified file in place. PATTERN is a [...]

Read More
4 Comments
bash

Customize the BASH PS1 command prompt

by
on
October 19, 2008

The PS1 environment controls the appearance of the BASH command line prompt. There are a variety of default prompts but they usually include username, hostname, and working directory. You can easily customize your prompt to display information important to you as well as add color and style formatting. Here we can see the default prompt [...]

Read More
1 Comment
bash

I/O redirection in BASH

by
on
October 16, 2008

One of the best features of the Linux command line is the ability to efficiently direct input and output to and from files and other programs. Every program begins with 3 open file streams. stdin (file descriptor 0) – input from the user, usually keyboard stdout (file descriptor 1) – standard output that is displayed [...]

Read More
No Comments
bash

Single versus double quotes in BASH

by
on
October 15, 2008

Understanding the difference between double versus single quotes is important when using BASH. Many times you may have seen them being used interchangeably. The basic difference is that variable names will be expanded within double quotes but not within single ones. This example shows the normal output with no quotes. $ echo $USER ryan As [...]

Read More
1 Comment
bash
Copyright 2008-2010 WiredRevolution.com. All rights reserved.