Beginners – BASH Special Characters

Valic —  November 29, 2012 — 1 Comment

Before we continue to study about UNIX operating system shell commands, it is important to understand that there are several symbols and characters that the shell interprets in special ways called BASH Special Characters. This means that certain typed characters:

  • Cannot be used in certain situations
  • May be used to perform special operations
  • Must be “escaped” if you want to use them in a normal way.
Character Explanation


Escape character. If you want to reference a special character, you must “escape” it with a backslash.
Example: touch filename\* – This command will create the file filename*


Directory separator. It’s used to separate a string of directory names.
Example: /var/www/htdocs


Current directory


Parent directory


User’s home directory


Represents 0 or more characters in a filename or by itself, all files in a directory.
Example: sql*2012 can represent the files sql2012, sql-backup2012, sql29-11-2012 etc.


Represents a single character in a filename.
Example: filename?.txt can represent filename1.txt, filenamex.txt.


Can be used to represent a range of values,  [0-9], [A-Z], etc.
Example: filename[0-2].txt represents the names filename0.txt, filename1.txt, and filename2.txt


“Pipe” . It’s mostly used to redirect the output of one command into another command.
Example: ls | more


Redirects output of a command into a new file. If the file already exists will be over-writed.
Example: ls > listoffiles.txt


Redirects the output of a command onto the end of an existing file. If the file does not exist, will be created.
Example: echo “test ” >> testfile.txt


Redirects a file as input to a program.
Example: more < listoffiles.txt


Command separator. Allows you to execute multiple commands on a single line.
Example: cd /var/log ; less syslog


Command separator as above, but only runs the second command if the first one finished without errors.
Example: cd /var/logs && less syslog


Execute a command in the background, and immediately get your shell back.
Example: find / -name log > logfiles.txt &

In this post I will show you how to manage your VE memory on OpenVZ VPS.

Here are some example commands that will help you to adjust the RAM for  OpenVZ:

256MB Guaranteed, 512MB Burstable
vzctl set 101 --vmguarpages 256M --save
vzctl set 101 --oomguarpages 256M --save
vzctl set 101 --privvmpages 256M:512M --save

512MB Guaranteed, 1024MB Burstable
vzctl set 101 --vmguarpages 512M --save
vzctl set 101 --oomguarpages 512M --save
vzctl set 101 --privvmpages 512M:1024M --save

1024MB Guaranteed, 2048MB Burstable
vzctl set 101 --vmguarpages 1024M --save
vzctl set 101 --oomguarpages 1024M --save
vzctl set 101 --privvmpages 1024M:2048M --save

NOTE: 101 is your VPS veid.

This article is about setting up Nginx + PHP-FastCGI on Debian 6.0.6 Squeeze

Step1. Install nginx and php5-cgi :

apt-get install nginx php5-cgi

Step2. Replace Nginx default virtualhosts config with the following content:

server {
listen [::]:80;
root /var/www/;
index index.html index.htm index.php;
access_log /var/log/;

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

NOTE: Replace with your own domain.

Step3. Create a  Debian init script to control the php-cgi daemon.

Continue Reading…

What is a command shell:

Command shell is a program that interprets commands,
Allows a user to execute commands by typing them manually at a terminal or automatically in programs called shell scripts.
A shell is NOT an operating system.
It is a way to interface with the operating system and run commands.

What is BASH:

The name itself is an acronym, BASH = Bourne Again SHell
Bash is a shell written as a free replacement to the standard Bourne Shell /bin/sh originally written by Steve Bourne for UNIX systems.
BASH has all of the features of the original Bourne Shell plus additions that make it easier to program.
BASH is Free Software and was adopted as the default shell on most Linux distributions.

The purpose of this new category is to introduce the Linux user  into Linux command shell and a few of its basic utilities.
It is created for the users with zero or limited exposure to the Linux command prompt.

This category is designed to accompany an instructor-led tutorial on this subject, and therefore some details have been left out.

Page 1 of 212