Special Characters

Alt + 0153..... ™... trademark symbol
Alt + 0169.... ©.... copyright symbol
Alt + 0174..... ®....registeredtrademark symbol
Alt + 0176 ...°......degre­e symbol
Alt + 0177 ...±....plus-or­-minus sign
Alt + 0182 ...¶.....paragraph mark
Alt + 0190 ...¾....fractio­n, three-fourths
Alt + 0215 ....×.....multi­plication sign
Alt + 0162...¢....thecent sign
Alt + 0161.....¡......upside down exclamation point
Alt + 0191.....¿.....­upside down question mark
Alt + 1...........smiley face
Alt + 2 ......☻.....bla­ck smiley face
Alt + 15.....☼.....su­n
Alt + 12......♀.....female sign
Alt + 11.....♂......m­ale sign
Alt + 6............s­pade
Alt + 5.............­Club
Alt + 3............. ­Heart
Alt + 4.............­Diamond
Alt + 13......♪.....e­ighth note
Alt + 14......♫......­beamed eighth note
Alt + 8721.... ∑.... N-ary summation (auto sum)
Alt + 251.....√.....s­quare root check mark
Alt + 8236.....∞.....­infinity
Alt + 24.......↑.....­up arrow
Alt + 25......↓......­down arrow
Alt + 26.....→.....ri­ght arrow
Alt + 27......←.....l­eft arrow
Alt + 18.....↕......u­p/down arrow
Alt + 29......↔... left right arrow

Introduction to Linux/Unix Shell Commands

The purpose of this document is to provide the reader with a fast and simple introduction on using the Linux command shell and some of its basic utilities. It is assumed that the reader has zero or very limited exposure to the Linux command prompt.


Command Shell

  • 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

BASH
  • Stands to Bourne Again SHell
  • Bash is a shell written a free replacement to the standard Bourne Shell (/bin/sh) originally written by Steave Bourne for UNIX systems 
  • It has all of the features of the original Bourne Shell, plus additions that make it easier to program with and use from the command line
  • Since it is Free Software, it has been adopted as the default shell on most Linux systems

The difference between BASH and DOS command prompt
  • Case Sensitivity - In Linux/UNIX, commands and filenames are case sensitive, meaning that typing "EXIT" instead of the proper "exit" is a mistake.
  • "\" vs. "/"  - In DOS, the forward-slash "/" is the command argument delimiter, while the backslash "\" is a directory separator. In Linux/UNIX, the "/" is the directory separator, and the "\" is an escape character. More about these special characters in a minute!
  • Filenames - The DOS world uses the "eight dot three" filename convention, meaning that all files followed a format that allowed up to 8 characters in the filename, followed by a period ("dot"), followed by an option extension, up to 3 characters long (e.g FILENAME.TXT). In UNIX/Linux, there is no such thing as file extension. Periods can be placed at any part of the filename, and "extensions" may be interpreted differently by all programs, or not at all. 

Special Characters
Before we continue to learn about Linux shell commands, it is important to know that there are many symbols and characters that the shell interprets in special ways. 
This means that certain typed characters: 
  • cannot be used in certain situations, 
  • may be used to perform a special operations, or, 
  • must be "escaped" if you want to use them in a normal way. 
Character Description Description
/ Escape character. If you want to reference a special character, you must "escape" it with a backslash first.

Example: touch /tmp/filename \*  
\ Directory separator, used to separate a string of directory names.

Example: /usr/src/linux 
. Current Directory. Can also "hide" files when it is the first character in a filename
.. Parent directory 
~ (tilde) User's home directory 
* Represents 0 or more characters in a filename, or by itself, all files in a directory.

Example: pic*2002 can represent the files pic2002, picJanuary2002, picFeb292002, etc.
? Represents a single character in a filename

Example: hello?.txt can represent hello1.txt, helloz.txt, but not hello22.txt 
[ ] Can be used to represent a range of values, e.g. [0 - 9], [A-Z], etc.

Example: hello[0-2].txt represents the names hello0.txt, hello1.txt, and hello2.txt
| "Pipe". Redirect the output of one command into another command.

Example: ls | more 
> Redirect output of a command into a new file. If the file already exists, over-write it.

Example: ls > myfiles.txt 
>> Redirect the output of a command onto the end of an existing file

Example: echo "Mary 555-1234" >> phonenumbers.txt
< Redirect a file as input to a program.

Example: more < phonenumbers.txt 
; Command separator. Allows you to execute multiple commands on the single line

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

Example: cd /var/logs && less messages
& Execute a command in the background, and immediately get your shell back.

Example: find / -name core > /tmp/corefiles.txt & 

Cent OS 5 Mail Server



1. Install Postfix and Mail Transport Agent Switcher
  1. Open Package Manager Tool A.K.A (Add/Remove Software)
  2. Under Servers>Mail Server Click Optional Package
  3. Click/Check postfix-(version codes).i386 - Postfix Mail Transport Agent
  4. Under Servers>Server Configuration Tools>Click Optional Package
  5. Click/Check system-switch-mail-gnome-(version codes).noarch – A GUI interface for Mail Transport Agent Switcher
  6. Click Apply
  7. Goto System>Administration>Mail Transport Agent Switcher
  8. Select Postfix then Click Ok
  9. Copy the content of etc_postfix to /etc/postfix
  10. Then Restart the postfix service by typing (service postfix restart) into Terminal
  11. To test Postfix open the Terminal and type:
·       telnet localhost smtp
·       ehlo localhost
·       mail from:<johndoe>
·       rcpt to:<johndoe>
·       data
·       test
·       .
·       quit
  1. To check log file /var/log/maillog if theres problem arise


2. Dovecot POP3/IMAP Server Installation and Configuration
  1. Open Package Manager Tool A.K.A (Add/Remove Software)
  2. Under Servers>Mail Server Click Optional Package
  3. Click/Check dovecot -(version codes).i386 - Dovecot Secure imap server
  4. Copy the content of etc_dovecot to /etc/dovecot/
  5. Then Restart the postfix service by typing (service dovecot restart) into Terminal
  6. To test Dovecot open the Terminal and type:
·       telnet localhost pop3 'replace localhost with your server name
·       user johndoe 'replace johndoe with your chosed user name
·       pass password 'replace password with your password
·       list
·       retr 1
·       quit
  1. To check log file /var/log/maillog if theres problem arise


3. Postfix SMTP Authentication and Dovecot SASL
  1. Since we already copied the content of etc_dovecot to /etc/dovecot
  2. Restart the service again by typing (service dovecot restart) and (service postfix restart) into the Terminal
4. SquirrelMail Webmail Installation and Configuration
  1. Open Package Manager Tool A.K.A (Add/Remove Software)
  2. Under Servers>Mail Server Click Optional Package
  3. Click/Check SquirrelMail -(version codes).i386 - SquirrelMail Webmail client
  4. Start httpd service by typing (service httpd restart) into the Terminal
  5. Open /usr/share/squirrelmail/config/conf.pl:
·       Type 2 and Press Enter to select the Server Settings menu
·       Type 1 and Press Enter to select the Domain menu
·       Type in your domain name and Press Enter
·       Type S to Save data
Type Q to Quit
  1. Extract squirrelmail-1.4.21.tar.gz to /usr/share/ that can found from the folder
·       Rename the old squirrelmail to squirrelmail correspond its version
·       Copy the following to the squirrelmail-1.4.21
·       Configuration files
·       Plugins
·       Skins
·       Translations
·       Themes (if you've edited or added any of them)
·       Preferences (but only if you keep them inside the SquirrelMail directory)
·       Rename the squirrelmail-1.4.21 to squirrelmail
  1. Extract retrieveuserdata.0.9-1.4.3 to /usr/share/squirrelmail/plugins/
  2. Open /usr/share/squirrelmail/config/conf.pl
·       Type in 8 and press Enter to list the Plugins submenu
·       Install the retrieveuserdata plugin by typing in the number corresponding to it and press Enter.
·       Return to the Main Menu by typing in 9 and press Enter. Go to the General Options by typing in 4 and press Enter. In the General Options, type in 9 and press Enter to configure the editing of identity. This option will allow you to disable editing of the name and email address since this will be automatically updated. Save your changes when you are done.
·       Login to SquirrelMail and go to the Options page and click Personal Information. The Full Name and E-mail Address should have been automatically filled up.
·       By default, RetrieveUserData will retrieve the name and email address from the Linux system accounts, but you can configure this by editing the file /usr/share/squirrelmail/plugins/retrieveuserdata/config.php.
  1. Extract change_passwd-4.2f.tar.gz to /usr/share/squirrelmail/plugins/
Extract compatibility-2.0.16-1.0.tar.gz to /usr/share/squirrelmail/plugins/
·       From a Terminal window, type in /usr/share/squirrelmail/config/conf.pl and press Enter. This will launch the SquirrelMail Configuration utility
·       Type in 8 and press Enter to list the Plugin submenu
·       Install the change_passwd_plugin by typing in the number corresponding to it and press Enter
·       When you are done, type in q and press Enter to quit then type in y and press Enter to save your changes
·       If your version of SquirrelMail is not 1.4.13 and higher or 1.5.1 and higher, you need to patch your SquirrelMail source Goto. /usr/share/squirrelmail/plugins/compatibility and apply the compatibility path by typing in the command s below
·       cd /usr/share/squirrelmail/plugins/compatibility/
·       patch -p0 < patches/compatibility_patch-1.4.8.diff
·       Replace 1.4.8 with your SquirrelMail version
·       In the /usr/share/squirrelmail/plugins/change_passwd directory, copy the file config.php.sample
·       and save it as config.php.sample and save it as config.php
·       Edit config.php and review the default settings
·       Below are settings in config.php you may wish to change


$minimumPasswordLength - Minimum length of the password.
$changePasswdInLogin - Change password from the login form.
  1. To t est the SquirrelMail Change Password
·       Login to SquirrelMail and go to the Options page. You should see the new Change Password section.
·       Click the Change Password link to view the new Change Password page.
  1. (Optional) If you will be retrieving user information from an Active Directory or LDAP server, it will be easier if you setup the LDAP addressbook first so that the plugin can use the LDAP connection details there. Then all you have to do is comment the line $SQRUD_RETRIEVE_DATA_FROM = "passwd.php" and uncomment the line $SQRUD_RETRIEVE_DATA_FROM = "ldap.php" in the configuration file.
5. SquirrelMail Change Password Howto
  1. Install the Poppassd service by opening the poppassd_repository(double-click) found inside the folder
  2. Install poppassd by typing into the Terminal:
·       yum install poppassd
  1. Enable the poppassd service
·       System>Administration>Server Settings>Services>On Demand Services(Tab)
·       Look for poppassd Click/Cheack then Click Save
  1. Edit the file /etc/pam.d/poppassd and replace the content with the lines below
·       auth required pam_unix.so
·       account required pam_unix.so
·       password requisite pam_cracklib.so
·       password sufficient pam_unix.so md5 shadow
  1. The line password requisite pam_cracklib.so requires the new password to be strong and at least six (6) characters long. You can leave it out if you do not want that restriction.
  2. In a Terminal window, type in the highlighted commands below.
Sample poppassd session. Replace johndoesecret and p@ssw0rd with your own valid user account, old password and new password respectively.
·       telnet localhost 106
·       user johndoe
·       pass secret
·       newpass p@ssw0rd
·       quit
6.) Firewall Configuration Howto
  1. Goto System>Administration>Security Level and Firewall s
·       POP3
·       110:tcp
·       POP3S
·       995:tcp
·       IMAP
·       143:tcp
·       IMAPS
·       993:tcp
  1. Set security level to Permissive mode in SELINUX(Tab) or system-config-securitylevel-tui in Terminal to see text mode


7.) MailScanner Setup Howto
  1. Install rpm_forge from the folder
  2. Lowering the RPMforge priority
  3. Type in (yum install yum-priorities) to the Terminal or from the folder
  4. Edit the file /etc/yum.repos.d/rpmforge.repo and add the line below:
·       priority=10
  1. Test your configuration using the command below. You should see a priority protections message in the output.
·       yum check-update
  1. In the address box, type in http://www.mailscanner.info/downloads.html and press Enter. Download the stable version for RedHat, Fedora and Mandrake Linux.
  2. The MailScanner source code should now be on your desktop. Right click the newly downloaded
  3. file and click Extract Here.
  4. After extracting, a MailScanner folder should be found on your Desktop. Right click the MailScanner folder and click Open in Terminal.
  5. In the terminal window, type in all the command below (in one line) to install the required Perl modules from the RPMforge repository.
Type in:
·       yum install perl-Archive-Zip
·       perl-DBI
·       perl-DBD-SQLite
·       perl-Filesys-Df
·       perl-Net-CIDR perl-OLE-Storage_Lite
·       perl-Sys-Hostname-Long
  1. Then finally type in (yum install --nogpgcheck mailscanner*) then press Enter


Setup VPN on Local Network (Windows)



On Server Side
  1. Go to “New Connection Wizard” then “Click Next”
  2. Setup Advance Connection
  3. Select “Accept Incoming Connections” then “Click Next”
  4. Select “Allow virtual private connections” then “Click Next”
  5. Select “Users allowed to connect”
  6. Specify IP Address Range then “Click Next”
  7. Then finally “Click Finish”

On Client Side
  1. Configure IP Address, the gateway must be the IP Address of the Server
  2. Goto “New Connection Wizard” then “Click Next”
  3. Select “Connect to the Network at my workplace” then “Click Next”
  4. Select “Virtual Private Network connection” then “Click Next”
  5. Enter your “Company Name” it will become your connection name then “Click Next”
  6. Enter “Host Name” or “IP Address of the VPN Server you will be connecting”
  7. Then finally select “Make Shortcut on Desktop” then “Click Finish”

Testing Connection:
  1. On Client Side Double+Click the Shortcut on your Desktop then input your User Name and Password allowed on the Server then “Click Connect”
  2. You will notice the network is registering its connection
  3. On Server Side you will notice the connection labeled with your User Name will appear beside the LAN Connection.

How to make linux ghost image


Creating or Restoring a drive image locally


  1. Boot to the G4L CD. Select the newest kernel.
  2. Once everything loads, you will see some disclaimers. Hit "enter" until you get to a command prompt.
  3. Type "g4l" and hit enter to run G4L. Select "YES" to accept the disclaimer.
  4. Select "RAW Mode", then "Local Use"
  5. Select "Pick drive", then choose the drive where the image file will be saved (or where it is located, if you are restoring)
  6. Select "config filename".
    1. If you are backing up, enter the name of the image file you will create.
    2. If you are restoring, enter the name of the image file you want to restore.
  7. Begin the operation
    1. If you are backing up a drive/partition, select "backup". Choose the drive or partition to backup.
    2. If you are restoring, select "restore". Choose the drive or partition you want to restore to.
There are a few other options here for special circumstances. For instance, if you are backing up to a FAT32 or similar partition, you may want to turn on File splitting to avoid going over file size limitations. If you are backing up or restoring an NTFS partition (and only the partition, not the whole drive), you can use NTFSClone backup/restore to save time and space. You can also choose a method of compression to use on the image file; the default, lzop, is recommended.
NOTE: you must restore with the same compression setting you saved with. I recommend putting the compression method in the image file name, e.g. "myharddrive.img.lzop". Also, normal backup/restore is incompatible with NTFSClone backup/restore. If you use NTFSClone, you might want to note that in the filename as well, e.g. "myWindowsDrive.ntfs.img.lzop". 

Install nano on pfSense



 pkg_add -r ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-8.1-release/Latest/nano.tbz  


or


on terminal
ssh to your pfsense

then, copy paste the code above
and press enter

then, try nano by typing nano

congrats, you will get nano editor on pfsense


pfSense Captive Portal passthrough port and ip address


If you need to allow certain application to run along with the log-in screen, for example 
a chat box on the pfSense's Captive Portal. you need to first allow a  specific port or an IP Address to passthrough a the Captive Portal.

Go to terminal

 nano /etc/inc/captiveportal.inc  

use ctrl+w to find

Any rule after this line
 # redirect non-authenticated clients to captive portal  
 add 65532 fwd 127.0.0.1,{$listenporthttp} tcp from any to any dst-port 80 in.....  

will get blocked so it should be added before it's blocked.

let say I want port 5900 to open in captive portal, I should:

 add 5900 pass tcp from any to any out  
 # redirect non-authenticated clients to captive portal  
 add 65532 fwd 127.0.0.1,{$listenporthttp} tcp from any to any dst-port 80 in.....  

How to fix Starting emulator for AVD 'androidname' PANIC: Could not open: androidname on MAC OSX

On MAC OSX you may encounter this error when you programming in android using Android SDK on Eclipse Kepler. This happens when you logged in to your root account and by trying to run a specific android avd and nothing happens.

Starting emulator for AVD 'androidname'
PANIC: Could not open: androidname