There is a nice blog about Blogspot. If you use Blogger as free blog, you should check this blog: http://blogknowhow.blogspot.com/. There are so many resource about styling, monetizing, and optimizing your blogspot space.
Let's check it out and enjoy!
Wednesday, April 27, 2011
How to Tunnel SSH via HTTP Proxy
I have to access ssh server but there is http proxy when I want to go to internet. How can I tunnel ssh via http proxy? Here are the way to do it:
# Download corkscrew. It is easy tool for tunneling SSH through HTTP proxies
# Extract corkscrew then configure and install it
# Download corkscrew. It is easy tool for tunneling SSH through HTTP proxies
# Extract corkscrew then configure and install it
tar -xzvf corkscrew.tar.gz# Create ~/.ssh/proxyauth file and set authentication for http proxy server
cd corkscrew
./configure
make install
username:password# Open ~/.ssh/config file. Add proxy server ip address and its authentication in proxyauth file like this:
Host *# Try to access your server via ssh
ProxyCommand corkscrew proxy_ip_address proxy_port %h %p ~/.ssh/proxyauth
ssh username@example.comAnd it's all done. Enjoy!
Labels:
Ubuntu Proxy
Monday, April 18, 2011
Apache Rewrite Modul Problems in Linux Ubuntu
I often have a problem with rewrite modul in Apache. When you have the same problem like me, you should check:
# RewriteBase syntax in .htaccess
# "Allow all" option in /etc/apache2/sites-enabled directory. Here are the example of 000-default file in sites-enabled directory (in tag Directory "/var/www/somedir"):
# Is .htaccess file executable?
# Make sure rewrite module is loaded in Apache. When this module successfully loaded, it will appear in mods-enabled directory as rewrite.load file. You can load them by issuing:
# RewriteBase syntax in .htaccess
# "Allow all" option in /etc/apache2/sites-enabled directory. Here are the example of 000-default file in sites-enabled directory (in tag Directory "/var/www/somedir"):
Order allow,deny
Allow from all
AllowOverride All
# Is .htaccess file executable?
# Make sure rewrite module is loaded in Apache. When this module successfully loaded, it will appear in mods-enabled directory as rewrite.load file. You can load them by issuing:
sudo a2enmod rewriteJust double check them. Enjoy!
Labels:
Ubuntu Apache
Wednesday, April 13, 2011
First Timer RabbitVCS Subversion Client
After setting proxy in RabbitVCS, I have a folder that contains app files to be versioned. How can we add these files to our subversion server?
# Right click in the folder, choose Checkout
# Set subversion servers, for example: https://example.com/svn/apps
# Set directory to be versioned
# Click OK or Finish.
Then we can submit all of app files by right-clicking the folder and choose Commit. Select or deselect any files you want to Commit. Wait a moment and you're done versioning your app files for the first time. Enjoy!
# Right click in the folder, choose Checkout
# Set subversion servers, for example: https://example.com/svn/apps
# Set directory to be versioned
# Click OK or Finish.
Then we can submit all of app files by right-clicking the folder and choose Commit. Select or deselect any files you want to Commit. Wait a moment and you're done versioning your app files for the first time. Enjoy!
Labels:
Ubuntu Subversion
How to Set Proxy in RabbitVCS Subversion Client
I use RabbitVCS as subversion client in my little Ubuntu box. Since I should work behind proxy, I have set up proxy username and password in RabbitVCS. Don't forget to be root to configure :).
# Go to /etc/subversion
# Go to /etc/subversion
cd /etc/subversion# There are two files: servers and config. Open servers file
vi servers# Find [global] section and set proxy host, username, and password
[global]And you're ready to version your apps. Enjoy!
http-proxy-host = proxy_ip_address
http-proxy-port = proxy_port
http-proxy-username = username
http-proxy-password = password
Labels:
Ubuntu Proxy
Monday, April 11, 2011
How to Execute Wget Behind Proxy
Two days getting headache because of working behind proxy, here is one of the result: wget command with using proxy option enabled.
Don't forget to set your proxy first. Enjoy!
wget --proxy-user=username --proxy-passwd=password
http://example.com/file.zip
Don't forget to set your proxy first. Enjoy!
Labels:
Ubuntu Proxy
Curl Using Proxy in Linux Console
Going crazy using Linux console? Here is how to use curl in console behind proxy.
Enjoy!
curl -x proxy_ip_address:port -U username:password http://example.com
Enjoy!
Labels:
Ubuntu Proxy
Sunday, April 10, 2011
How Many Watt Consumed in Ubuntu Laptop?
Yay... we will estimate how many watt consumed in Ubuntu laptop using data from ACPI interface. We have measured voltage and current, getting exact value of them, trying to make a simple shell script, and installing calculator package in console.
By putting all of these stuffs altogether, we will estimate how many power used by our lovely Ubuntu box.
# Make a shell script to cat voltage and ampere usage
# Measure the power by simply multiply voltage and current consumed
This shell script has been tested in Ubuntu Lucid Lynx 10.04 and it works well. Enjoy!
By putting all of these stuffs altogether, we will estimate how many power used by our lovely Ubuntu box.
# Make a shell script to cat voltage and ampere usage
#!/bin/bash# Make two variables to store voltage and ampere value
cat /proc/acpi/battery/C1AC/state | grep "present voltage" |
awk '{print $3}'
cat /proc/acpi/battery/C1AC/state | grep "present rate" |
awk '{print $3}'
volt=`cat /proc/acpi/battery/C1AC/state | grep "present voltage" |# Divide variable volt and ampere by 1000 because it still in mV or mA unit
awk '{print $3}'`
ampere=`cat /proc/acpi/battery/C1AC/state | grep "present rate" |
awk '{print $3}'`
volt=`echo "scale=3;$volt/1000"|bc`Parameter scale is used to set precision. If we set them to 3, then we will get three decimal places precision.
ampere=`echo "scale=3;$ampere/1000"|bc`
# Measure the power by simply multiply voltage and current consumed
power=`echo "scale=3;$v*$a"|bc`# And the full shell script is illustrated below:
#!/bin/bash# And it will give us a message like this:
volt=`cat /proc/acpi/battery/C1AC/state | grep "present voltage" |
awk '{print $3}'`
ampere=`cat /proc/acpi/battery/C1AC/state | grep "present rate" |
awk '{print $3}'`
volt=`echo "scale=3;$volt/1000"|bc`
ampere=`echo "scale=3;$ampere/1000"|bc`
echo "Present voltage: " $volt "Volt"
echo "Present current: " $ampere "Ampere"
power=`echo "scale=3;$volt*$ampere"|bc`
echo "Present power :" $power "Watt"
Present voltage: 16.285 Volt
Present current: 1.507 Ampere
Present power : 24.541 Watt
This shell script has been tested in Ubuntu Lucid Lynx 10.04 and it works well. Enjoy!
Labels:
Ubuntu Power Consumption
[Linux Ubuntu] Getting Exact Value of Voltage and Current
We are now one step closer to measuring power process. In the previous explanation, we have got voltage and current value but it still has some obstacles. I mean, there are string "present voltage:" and "present rate" in voltage and current value, respectively. How can we remove them? We employ grep to get certain line and we can use awk get certain column of one line output.
cat /proc/acpi/battery/C1AC/state | grep "present voltage" |$3 in awk means it only prints the third column. The value of first column is string "present" and the second one is "voltage" or "rate" in current value. This command will print the exact value only without obstacles. Enjoy!
awk '{print $3}'
cat /proc/acpi/battery/C1AC/state | grep "present rate" |
awk '{print $3}'
Labels:
Ubuntu Power Consumption
How to Make a Shell Script in Linux?
Yeah, like you say, it's for newbie only :D. We will make a shell script to display voltage in mV and current in mA like I post before. Shell script can contain one or more lines of instruction usually issued in Terminal.
# Open your editor (I always choose vi) type:
# Save these shell script, for example, myfile.sh
# Change the mode of file so that it can be executed
# Open your editor (I always choose vi) type:
#!/bin/bash# Don't forget to replace "C1AC" with your own battery type
cat /proc/acpi/battery/C1AC/state | grep "present voltage"
cat /proc/acpi/battery/C1AC/state | grep "present rate"
# Save these shell script, for example, myfile.sh
# Change the mode of file so that it can be executed
chmod +x myfile.sh# Run this script by typing this instruction in your Terminal:
./myfile.sh# The output will look like this:
present voltage: 16778 mVShell script will simplify our life. Believe me and enjoy!
present rate: 702 mA
Labels:
Ubuntu Shell
How Many Volt Consumed by Ubuntu Laptop?
Now we will observe how many watt consumed by Ubuntu laptop. Similar with how to check current (in ampere) consumed, we will only replace the grep command.
# Goto /proc/acpi/battery directory and go to directory name based on your battery type (i.e. C1AC)
The voltage consumed is shown in mV. Enjoy!
# Goto /proc/acpi/battery directory and go to directory name based on your battery type (i.e. C1AC)
cd /proc/acpi/battery/C1AC# Cat the content of state file and grep only the voltage
cat state | grep "present voltage"# We will get output like this:
present voltage: 16410 mV
The voltage consumed is shown in mV. Enjoy!
Labels:
Ubuntu Power Consumption
How Many Ampere Consumed by Ubuntu Laptop?
We can monitor how many ampere consumed by our Ubuntu laptop. Unfortunately, we still can't do them in Ubuntu desktop. ACPI interface will be used to employ this technique.
# Goto /proc/acpi/battery directory
# We only want to get ampere used, so just grep them
We will use this technique to get power (in Watt) consumed by Ubuntu laptop. Enjoy!
# Goto /proc/acpi/battery directory
cd /proc/acpi/battery# There is only one directory and the name is different in accordance with laptop specifications. For example, my folder name is C1AC.
cd C1AC# You will see three files: alarm, info, and state. Try to show the content of "state" file
cat state# You will get a technical state about battery like shown here:
present: yes
capacity state: ok
charging state: charging
present rate: 1505 mA
remaining capacity: 840 mAh
present voltage: 16410 mV
# We only want to get ampere used, so just grep them
cat state | grep "present rate"# The output is ampere present rate shown in mA
present rate: 1505 mA
We will use this technique to get power (in Watt) consumed by Ubuntu laptop. Enjoy!
Labels:
Ubuntu Power Consumption
Is There any Calculator in Terminal?
Yeah, absolutely. You can use bc package in Linux Ubuntu. This is an arbitrary precision calculator language. Or, we can just call it "bash calculator" (bc). Simply issue this command:
Run them in terminal and you will get output: 5, -1, 6, and 2. We will use this calculator later in the next tutorial. Enjoy!
apt-get install bcOf course you have to be a root when issuing it. Now we will try bc to perform simple arithmetic operation, such as:
echo 2+3 | bc
echo 2-3 | bc
echo 2*3 | bc
echo 6/2 | bc
Run them in terminal and you will get output: 5, -1, 6, and 2. We will use this calculator later in the next tutorial. Enjoy!
Labels:
Ubuntu Terminal
[Linux Ubuntu] How to Put Harakat or Vowel Marks in Arabic Keyboard Layout
Now, you are able to enable Arabic keyboard layout and write them in Linux Ubuntu. What about adding harakat or vowel marks in Arabic? Follow these steps:
# Write the word first. For example, word "Al 'Ilmu"
العلم
# We should put fatha in character " ا ". To do this, put cursor behind character " ا ".
# In the Arabic keyboard layout, fatha is placed in character Shift + Q. So, press Shift + َQ and you will get: " اَ "
# Now put the cursor behind character " Ù„ " and add sukun mark by pressing Shift + X. You will get: اَلعلم
# Continue these steps until all of word is fulfilled with appropriate harakat (اَÙ„ْعِÙ„ْÙ…ُ). Enjoy!
# Write the word first. For example, word "Al 'Ilmu"
العلم
# We should put fatha in character " ا ". To do this, put cursor behind character " ا ".
# In the Arabic keyboard layout, fatha is placed in character Shift + Q. So, press Shift + َQ and you will get: " اَ "
# Now put the cursor behind character " Ù„ " and add sukun mark by pressing Shift + X. You will get: اَلعلم
# Continue these steps until all of word is fulfilled with appropriate harakat (اَÙ„ْعِÙ„ْÙ…ُ). Enjoy!
Labels:
Ubuntu Arabic
How to Write Arabic in Linux Ubuntu
How to write Arabic in Linux Ubuntu? First, you should enable Arabic keyboard layout. The Arabic keyboard layout will look like this picture (click to enlarge):
# Then, open your favorite text editor. I prefer gedit (Applications*Accessories*gedit Text Editor)
# Click Keyboard Preferences (usually it is placed in top-right of desktop panel) and it will be switched from USA to Ara
# Type your word one by one based on Arabic keyboard layout. It will be connected automatically.
# Type Space key to separate one word to another.
It is easy, isn't it? Enjoy!
# Then, open your favorite text editor. I prefer gedit (Applications*Accessories*gedit Text Editor)
# Click Keyboard Preferences (usually it is placed in top-right of desktop panel) and it will be switched from USA to Ara
# Type your word one by one based on Arabic keyboard layout. It will be connected automatically.
# Type Space key to separate one word to another.
It is easy, isn't it? Enjoy!
Labels:
Ubuntu Arabic
Saturday, April 9, 2011
What is Shortcut to Open Terminal in Linux Ubuntu?
I just got the shortcut to open terminal in Linux Ubuntu from my best friend. The shortcut is Ctrl+Alt+T. Haha... enjoy!
Labels:
Ubuntu Terminal
[Linux Ubuntu] How To Enable Arabic Keyboard Layout
I want to write Arabic in my Ubuntu box. So, I have to enable Arabic keyboard layout. Let's get started:
# Install language-pack-ar and language-pack-ar-base. These packages is used to translation for Arabic language
# Click Add button and you will get a dialox box contains two tabs: By Country and By Language. Choose By Language then Arabic for Language and Arabic for Variants.
# Click Add button once more and you will see this icon in your main panel in desktop:
# Click USA and it will be switched to Ara and vice versa.
I get this how-to here. Enjoy!
# Install language-pack-ar and language-pack-ar-base. These packages is used to translation for Arabic language
sudo apt-get install language-pack-ar language-pack-ar-base# Install ttf-arabeyes for Arabic fonts and libfribidi0 for Arabic Unicode algorithm
sudo apt-get install ttf-arabeyes libfribidi0# Don't forget language-support-ar package
sudo apt-get install language-support-ar# Then go to System*Preferences*Keyboard. There are some tabs, choose Layout
# Click Add button and you will get a dialox box contains two tabs: By Country and By Language. Choose By Language then Arabic for Language and Arabic for Variants.
# Click Add button once more and you will see this icon in your main panel in desktop:
# Click USA and it will be switched to Ara and vice versa.
I get this how-to here. Enjoy!
Labels:
Ubuntu Arabic
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
What should we do when get that message?
# Open /etc/php5/cli/conf.d/mcrypt.ini with your favourite editor like vi or gedit. You will see the content of mcrypt.ini
I get this message: "PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0" when trying to run PHP file via Terminal. Thanks for coming :).
# Open /etc/php5/cli/conf.d/mcrypt.ini with your favourite editor like vi or gedit. You will see the content of mcrypt.ini
# configuration for php MCrypt module# Replace sign '#' in the first line with ';'.
extension=mcrypt.so
I get this message: "PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0" when trying to run PHP file via Terminal. Thanks for coming :).
Labels:
Ubuntu PHP
How To Run PHP File in Terminal
Usually we use browser to execute PHP file. What about running your PHP file in Terminal? Let's follow these steps:
# Make sure you install these package:
# Run PHP file:
Run myfile.php once again and ta-daa... You will see
# Make sure you install these package:
- php5
- libapache2-mod-php5
- php-pear
- php5-mysql
- php5-pgsql
- php5-cli (those five are dependency of php5-cli)
sudo apt-get install php5 libapache2-mod-php5 php5-cli php-pear# Make a PHP test file echoing "Running PHP file via Linux terminal ... " and save it as myfile.php
php5-mysql php5-pgsql
# Run PHP file:
php myfile.php# You will get this message:
PHP Deprecated: Comments starting with '#' are deprecated in# Open /etc/php5/cli/conf.d/mcrypt.ini with your favourite editor like vi or gedit. You will see the content of mcrypt.ini
/etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
# configuration for php MCrypt module# Replace sign '#' in the first line with ';'.
extension=mcrypt.so
Run myfile.php once again and ta-daa... You will see
Running PHP file via Linux terminal ...in the Terminal. Enjoy!
Labels:
Ubuntu PHP
Monday, April 4, 2011
[Linux Ubuntu] How to Monitor Network Utilization
Once more component should be monitored. It is network interface utilization. Here is the command line:
sar -n DEV 1-n stands for network and DEV for DEVICE. This command will print network statistics for all available interfaces. In the next post we will try to daemonize these monitoring processes so that we don't need to issue the command manually.
Labels:
Ubuntu Network
[Linux Ubuntu] How to Check Disk and Swap Utilization
Disk and swap is a couple. When disk is full and he needs help, swap will ready to server :). How can we observe these two components of our server? Still employing sar, here is the code:
sar -d 1Parameter -d and -S for disk and swap, respectively. They will show us how many percent disk utilization or swap used. Enjoy!
sar -S 1
Labels:
Ubuntu Network
[Linux Ubuntu] How to Check Memory Utilization
Yeah, we still employ the powerful sar (System Activity Reporter). This is a command line to check memory utilization by using sar:
sar -r 1That's a per-second basis and you can add one more parameter to monitor the current second.
sar -r 1The last "1" means sar only show one record only. Thanks for reading :)
Labels:
Ubuntu Network
[Linux Ubuntu] How to Check CPU Utilization
Make sure you follow the steps explained in previous post :). Using sar, we can also monitor CPU utilization per second. Just press Ctrl+Alt+T to open Terminal and here is the command line to check CPU utilization per second:
sar -u 1If you want to know CPU utilization in current second, just add one parameter behind like this:
sar -u 1 1And it's done!
Labels:
Ubuntu Network
[Linux Ubuntu] How to Check CPU/Processor Speed
Let's follow these steps:
# Make sure your pc connect to mirror and get updated (don't forget to set up source.list file)
# Make sure your pc connect to mirror and get updated (don't forget to set up source.list file)
sudo apt-get update# Install sysstat package. This package contains complete-enough system performance tools for Linux
sudo apt-get install sysstat# We will use one of package contained in sysstat. It is sar (System Activity Reporter). To check CPU or processor speed per second, issue this command in your lovely Terminal
sar -m 1It is the mean speed of all of your processor cores. Enjoy!
Labels:
Ubuntu Network
[Linux Ubuntu] How to Set Repository in Terminal
Here is the content of source list file located in /etc/apt/source.list. I use this configuration for daily needs and it's enough (write it in one line only). You should edit source.list in root mode.
deb http://kambing.ui.ac.id/ubuntu maverick main universeKambing is updated mirror and I can easily access this server. Change this address based on your location and nearest repository in your resident. Enjoy!
restricted multiverse
Labels:
Ubuntu Terminal
Subscribe to:
Posts (Atom)