RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

Linux tutorials and more...


Addition and subtraction arithmetics with Linux date command

This article features some simple examples on how to add or subtract a time from a current date. At first we use a native date sytax to do this trick and later we will see how this can be done manually by converting date to an epoch time. Let's start with a simple backup script based on the date Linux command:

#!/bin/bash

tar cjf linuxconfig_$(date +%H%M-%d%m%Y).tar.bz2 ~/public_html

Every time the script is executed it will create a file with a current date included in the file name. The backup problem is solved. However, we do not usually want to keep all backup files indefinitely or until they consume all available free space. This is where the subtraction arithmetics with Linux date command comes handy. Let's see couple examples how to subtract time from a current date using date string: Subtract 10 years from a current date:

Share this linux post:

Submit Addition and subtraction arithmetics with Linux date command in Delicious Submit Addition and subtraction arithmetics with Linux date command in Digg Submit Addition and subtraction arithmetics with Linux date command in FaceBook Submit Addition and subtraction arithmetics with Linux date command in Google Bookmarks Submit Addition and subtraction arithmetics with Linux date command in Stumbleupon Submit Addition and subtraction arithmetics with Linux date command in Technorati Submit Addition and subtraction arithmetics with Linux date command in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Addition and subtraction arithmetics with Linux date command

 

Resetting Vodafone USB mobile broadband device with usb_modeswitch

First time I used my vodafone USB mobile broadband device on my Fedora Linux system it worked perfectly . However, after couple minutes I got disconnected I was not able to connect again even when the blue light on the Vodafone USB mobile broadband device was making a clear blue blinking signal that network was found and all I need to do is to just connect. Eventually after many attempts to make an Internet connection I had reseted it with a usb_modeswitch command to make it working again. It is not guaranteed solution but its worth to try.

If you are in the same situation you may also try to reset your Vodafone USB mobile broadband device. To do that we first need vendor and product ID in a hexadecimal form. To get this information execute:

$ lsusb

Share this linux post:

Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Delicious Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Digg Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in FaceBook Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Google Bookmarks Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Stumbleupon Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Technorati Submit Resetting Vodafone USB mobile broadband device with usb_modeswitch  in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Resetting Vodafone USB mobile broadband device with usb_modeswitch

 

The difference between parameter and variable in bash

Question:

Hi, in bash context what is the difference between parameter and variable?

Answer:

In a bash context a parameter is an entity that stores values. Furthermore, a parameter can be a name ( variable ), number ( positional parameter ) or special character ( special parameter ). Therefore, a variable is a parameter denoted by a name. ( see: man bash ). Let's have a closer look on all three bash parameters:

Share this linux post:

Submit The difference between parameter and variable in bash in Delicious Submit The difference between parameter and variable in bash in Digg Submit The difference between parameter and variable in bash in FaceBook Submit The difference between parameter and variable in bash in Google Bookmarks Submit The difference between parameter and variable in bash in Stumbleupon Submit The difference between parameter and variable in bash in Technorati Submit The difference between parameter and variable in bash in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: The difference between parameter and variable in bash

 

Avoiding tedious remote login ssh syntax

Although you have exchanged public keys with your remote server to avoid that boring bit of entering your super long secure user password everytime you are about to login, you still need to face ssh syntax in order get someting done. Yes, it is just single line command with few words but typing that line 30 times a day can take you at least 10 minutes of problem solving time, bore you and more iportatbly it may even give you a headache. This article outlines two alternative options on how to make ssh login procedure easier and thus keeping you sane longer.

Share this linux post:

Submit Avoiding tedious remote login ssh syntax  in Delicious Submit Avoiding tedious remote login ssh syntax  in Digg Submit Avoiding tedious remote login ssh syntax  in FaceBook Submit Avoiding tedious remote login ssh syntax  in Google Bookmarks Submit Avoiding tedious remote login ssh syntax  in Stumbleupon Submit Avoiding tedious remote login ssh syntax  in Technorati Submit Avoiding tedious remote login ssh syntax  in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Avoiding tedious remote login ssh syntax

 

Fedora - Missing /etc/syslog.conf a syslog configuration file

Question:

Hi, the book I'm reading makes a reference to /etc/syslog.conf as a syslog configuration file. I'm trying to locate it on my Fedora 14 Linux system and it appears that I do not have one. What is the location I need to look in to find this conf file.

Answer:

Fedora Linux does not include syslog with a default installation. You are more likely to have rsyslog installed on your system with /etc/rsyslog.conf as a configuration file. To confirm this run a rpm command to list all installed packages and pipe output to grep to search for syslog:

Share this linux post:

Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Delicious Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Digg Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in FaceBook Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Google Bookmarks Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Stumbleupon Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Technorati Submit Fedora - Missing /etc/syslog.conf a syslog configuration file in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Fedora - Missing /etc/syslog.conf a syslog configuration file

 

How do I display user ID associated with a process?

Question:

command which displays the user who invoked the command?

Answer:

ps command will print any user ID associated with any process on the system. To see all processes currently running on a Linux system a "ps" command can be used. The most common options used by ps command are "aux":

Share this linux post:

Submit How do I display user ID associated with a process? in Delicious Submit How do I display user ID associated with a process? in Digg Submit How do I display user ID associated with a process? in FaceBook Submit How do I display user ID associated with a process? in Google Bookmarks Submit How do I display user ID associated with a process? in Stumbleupon Submit How do I display user ID associated with a process? in Technorati Submit How do I display user ID associated with a process? in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: How do I display user ID associated with a process?

 

ls command with a long listing format output

Question:

When we execute the  ls command, the result contains first column like -rw-rw-r-- or lrwxrwxrwx. What does this mean?

Answer:

The output mentioned in your question can be produced with a following command:

ls -l filename

-l option of a ls command will instruct ls to display output in a long listing format which means that instead of output containing only a name(s) of file or directory the ls command will produce additional information. Example:

Share this linux post:

Submit ls command with a long listing format output in Delicious Submit ls command with a long listing format output in Digg Submit ls command with a long listing format output in FaceBook Submit ls command with a long listing format output in Google Bookmarks Submit ls command with a long listing format output in Stumbleupon Submit ls command with a long listing format output in Technorati Submit ls command with a long listing format output in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: ls command with a long listing format output

 

Match beginning and end of the filename using meta characters and regex

Question:

What is the name of the command which search for all the files starting with 'A' and end with 'K'?

Answer:

ls | grep ^A.*K$

Long answer:

Rather than searching for a single command we need a combination of commands to do this trick. Before we are able to do such a trick we need to get acquainted with couple bash features and terms:

Share this linux post:

Submit Match beginning and end of the filename using meta characters and regex in Delicious Submit Match beginning and end of the filename using meta characters and regex in Digg Submit Match beginning and end of the filename using meta characters and regex in FaceBook Submit Match beginning and end of the filename using meta characters and regex in Google Bookmarks Submit Match beginning and end of the filename using meta characters and regex in Stumbleupon Submit Match beginning and end of the filename using meta characters and regex in Technorati Submit Match beginning and end of the filename using meta characters and regex in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Match beginning and end of the filename using meta characters and regex

 

How do I locate all files installed from a RPM package?

Question:

Hi, recently I have installed couple packages into my Fedora Linux system. I'm just wondering how do I locate all files which had installed into my system.

Answer:

The easiest way to check all files installed on your system is to check a RPM package manifest which shows all files and location for any particular RPM package. Let's say that I downloaded a telnet-server-1.2-137.1.i586.rpm RPM package from some online source and I wish to see what this package contains and what files will I install into my system. The following command will reveal all that information:

Share this linux post:

Submit How do I locate all files installed from a RPM package? in Delicious Submit How do I locate all files installed from a RPM package? in Digg Submit How do I locate all files installed from a RPM package? in FaceBook Submit How do I locate all files installed from a RPM package? in Google Bookmarks Submit How do I locate all files installed from a RPM package? in Stumbleupon Submit How do I locate all files installed from a RPM package? in Technorati Submit How do I locate all files installed from a RPM package? in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: How do I locate all files installed from a RPM package?

 

Burning CD's over the Internet with or without ISO image

How many GUI CD/DVD burning applications do you know? Now, how many of them you can name that can burn an ISO image directly from ftp server or burn your remote directory over ssh? If you want to use a GUI burning software in such manner you would first need to mount your remote ftp or ssh directory as a part of a local system. However, this is possible without any extra effort by use of command line interface.

This article will illustrate some command line tricks on how to work with ISO images and how burning a data from a command line can safe you time. It really highlights a power of Linux command line interface.

Share this linux post:

Submit Burning CD's over the Internet with or without ISO image  in Delicious Submit Burning CD's over the Internet with or without ISO image  in Digg Submit Burning CD's over the Internet with or without ISO image  in FaceBook Submit Burning CD's over the Internet with or without ISO image  in Google Bookmarks Submit Burning CD's over the Internet with or without ISO image  in Stumbleupon Submit Burning CD's over the Internet with or without ISO image  in Technorati Submit Burning CD's over the Internet with or without ISO image  in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Burning CD's over the Internet with or without ISO image

 

Creating an Incremental backup with Linux and pax archive tool

pax is an archive utility somewhere between cpio and tar. This is just because is independent of the specific archive format, and supports a wide variety of different archive formats. It can perform simple tasks as creating a compressed archive of a selected directory or it can as much easily create a daily incremental backups. In this short article we will see how to protect our daily work by creating an incremental backup with pax.

Share this linux post:

Submit Creating an Incremental backup with Linux and pax archive tool in Delicious Submit Creating an Incremental backup with Linux and pax archive tool in Digg Submit Creating an Incremental backup with Linux and pax archive tool in FaceBook Submit Creating an Incremental backup with Linux and pax archive tool in Google Bookmarks Submit Creating an Incremental backup with Linux and pax archive tool in Stumbleupon Submit Creating an Incremental backup with Linux and pax archive tool in Technorati Submit Creating an Incremental backup with Linux and pax archive tool in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Creating an Incremental backup with Linux and pax archive tool

 

Automatically mount USB external drive with autofs

Question:

My Debian (up to date) system will automount USB pen drives on the fly, but not a 1 Tb external USB drive (Iomega), which will mount but it has to be attached before booting. How to I change the behaviour for the Iomega usb large drive so I can mount it after the system is up? Thanks.

Answer:

If your 1 Tb external USB drive mounts when it is attached before booting you may have a line in your /etc/fstab configuration file which mounts it during the boot time. If this is the case and you plug in your external USB drive after the boot, execute as a root user:

# mount -a

This will mount all devices which are not currently mounted, including your Iomega USB drive.

However, this may not be the most reliable solution since the base device file name for your drive can be different every time you plugin your USB disk. Since you have already mentioned that you are using other USB pen drives, your base device file name for your Iomega USB disk can be anything like: /dev/sdb1, /dev/sdd1 or /dev/sdXn .

I have exactly the same problem with my external WD USB drive as it mounts automatically in Fedora but not in Debian. Therefore,  I recommend use autofs. autofs is very simple a neat solution. It takes little bit of configuration but its worth it !

Make USB device base name permanent

To avoid any confusion whether base name for your USB block device is /dev/sdb1, /dev/sdd1 or /dev/sdXn we make it permanently /dev/Iomega anytime you plug it in. This can be done with help of udev device manager. You should have udev already installed on your system, otherwise install it with:

# apt-get install udev

Next, search for a current base name of your external USB disk using fdisk command:

# fdisk -l

This will return something like this:

OUTPUT:

Disk /dev/sdc: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x001425a0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      243201  1953512001    b  W95 FAT32

Where the base name for your external USB device is /dev/sdc. Next, use udevinfo command with /dev/sdc as an argument to get model attribute:

$ udevinfo -a -p /sys/block/sdc/ | grep model
    ATTRS{model}=="Ext HDD 1021    "

Now, that we have model attribute, we can add it to /etc/udev/rules.d/custom.rules by following line:

SUBSYSTEM=="scsi", ATTRS{model}=="Ext HDD 1021    ", SYMLINK+="Iomega%n"

At this point all we need to do is restart udev device manager:

Share this linux post:

Submit Automatically mount USB external drive with autofs in Delicious Submit Automatically mount USB external drive with autofs in Digg Submit Automatically mount USB external drive with autofs in FaceBook Submit Automatically mount USB external drive with autofs in Google Bookmarks Submit Automatically mount USB external drive with autofs in Stumbleupon Submit Automatically mount USB external drive with autofs in Technorati Submit Automatically mount USB external drive with autofs in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Automatically mount USB external drive with autofs

 

Using rsync over ssh as an ultimate backup tool

There are many backup tools around and many ways how to use them. For example, it is possible to use gzip and ftp to make a local copy of your web site. This approach have couple drawbacks such us: data are transferred over the internet unencrypted and we are most likely transferring data which we had copied over the day before.

To solve an unencrypted transfer problem we can instead of ftp use scp. However, this time the transfer time will be even longer as scp will create an extra overhead of creating encrypted tunnel for our backup internet connection. To stop transferring a duplicate data we can use rsync. If we combine rsync with ssh, compression, bash and cron we can end up with a ultimate backup tool.

Let's create simple but powerful backup solution using rsync, ssh, compression and cron scheduler:

Passwordless ssh

At this point we need to create passwordless ssh login. By doing this we can avoid the need of entering password when doing our backup. This way we can make the whole backup process completely automatic. Please follow this tutorial to make ssh login to your server without password.

rsync installation

If you have not done so yet install rsync tool as a root user:
For Ubuntu, Debian enter as:

# apt-get install rsync

And Fedora, RHEL and CentOS:

# yum install rsync

Making a database backup

In case that your website is using database such as mysql we first need to make a database backup. Therefore. our backup bash script starts with following lines:

#!/bin/bash 
 
# create database backup 
/usr/bin/ssh user@server.remote '( mysqldump --password='pass' \  
mydatabase > ~/public_html/mywebsite/mydatabase.sql )'

Share this linux post:

Submit Using rsync over ssh as an ultimate backup tool   in Delicious Submit Using rsync over ssh as an ultimate backup tool   in Digg Submit Using rsync over ssh as an ultimate backup tool   in FaceBook Submit Using rsync over ssh as an ultimate backup tool   in Google Bookmarks Submit Using rsync over ssh as an ultimate backup tool   in Stumbleupon Submit Using rsync over ssh as an ultimate backup tool   in Technorati Submit Using rsync over ssh as an ultimate backup tool   in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Using rsync over ssh as an ultimate backup tool

 

Limit user environment with ulimit Linux command

Whether it is user intention or just accident it may happen, that a single user can eat up all available system resources such as RAM memory or disk space. Depends on the nature of you Linux system you may want to limit your users to only what they might actually need.

Let's start with something like a fork bomb:

:(){ :|:& };:

The line above can almost instantly consume all resources since it creates recursive function all to it self as it forks unlimited children processes. One does not even need a root privileges to crash your Linux system. What about to limit user by a number of process he/she can spawn:

NOTE: All limits are applied to a current shell session only. To make a permanent change system wide use /etc/profile .

$ ulimit -u 10
$ :(){ :|:& };:
bash: fork: retry: Resource temporarily unavailable

This takes care of the fork bomb problem. But what about disk space? Linux command ulimit can limit users to create files bigger than a certain size:

Share this linux post:

Submit Limit user environment with ulimit Linux command in Delicious Submit Limit user environment with ulimit Linux command in Digg Submit Limit user environment with ulimit Linux command in FaceBook Submit Limit user environment with ulimit Linux command in Google Bookmarks Submit Limit user environment with ulimit Linux command in Stumbleupon Submit Limit user environment with ulimit Linux command in Technorati Submit Limit user environment with ulimit Linux command in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Limit user environment with ulimit Linux command

 

Change tty font size with Grub 2 boot console resolution

Question:

I'm using ubuntu 10.04. How can I increase the font size in the ttys ?

Answer:

Increasing / decreasing font size on tty consoles is linked to a console resolution. Therefore, to increase your font size you need to decrease a console screen resolution by changing grub2 default settings. Please note that your Ubuntu Linux is using grub2 so looking inside /boot/grub/menu.lst would not do any help. Instead we concentrate on /etc/default/grub file.

Before making any permanent changes to your Ubuntu Linux system we first try to change a console screen resolution directly from a grub boot line option right after reboot.

NOTE: There is no guarantee that any of the options below will work. This are just generic and no hardware specific solutions.

Option 1:

First choose a resolution number from the table below:

 

640x480

800x600

1024x768

1152x864

1280x1024

1600x1200

8bit

769

771

773

353

775

777

15bit

784

787

790

 

793

796

16bit

785

788

791

355

794

797

24bit

786

789

792

 

795

798

Let's say that we first try 795. Now reboot your system and edit a grub boot line with 'e' key and add after ro option:

vga=795

Once you altered line with the above vga option press CTRL+x to boot.

Option 2:

You can also try specify nomodeset instead of vga parameter. Reboot and edit grub boot line with "e' and add nomodeset after ro option:

Share this linux post:

Submit Change tty font size with Grub 2 boot console resolution in Delicious Submit Change tty font size with Grub 2 boot console resolution in Digg Submit Change tty font size with Grub 2 boot console resolution in FaceBook Submit Change tty font size with Grub 2 boot console resolution in Google Bookmarks Submit Change tty font size with Grub 2 boot console resolution in Stumbleupon Submit Change tty font size with Grub 2 boot console resolution in Technorati Submit Change tty font size with Grub 2 boot console resolution in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: Change tty font size with Grub 2 boot console resolution

 

How do I print all arguments submitted on a command line from a bash script?

Question:

How do I print all arguments submitted on a command line from a bash script?

Answer:

There are couple ways how to print bash arguments from a script. Try some scripts below to name just few.

In this first script example you just print all arguments:

 #!/bin/bash 
echo $@ 

If you intend to do something with your arguments within a script you can try somethign simple as the following script:

 #!/bin/bash 
 for i; do 
echo $i done

Next we have some script which are doing the same as the previous bash script but employ different approach:

 #/bin/bash 
 for i in $*; do 
   echo $i 
 done

Let's print all bash arguments using shift:

Share this linux post:

Submit How do I print all arguments submitted on a command line from a bash script? in Delicious Submit How do I print all arguments submitted on a command line from a bash script? in Digg Submit How do I print all arguments submitted on a command line from a bash script? in FaceBook Submit How do I print all arguments submitted on a command line from a bash script? in Google Bookmarks Submit How do I print all arguments submitted on a command line from a bash script? in Stumbleupon Submit How do I print all arguments submitted on a command line from a bash script? in Technorati Submit How do I print all arguments submitted on a command line from a bash script? in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.
Add a comment

Read more: How do I print all arguments submitted on a command line from a bash script?

 

Page 4 of 9