• : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.

BASH - Display date/time, hostname and current directory

To display date/time, hostname and current directory use the following command in your BASH prompt and press enter.
PS1="[\d \t \[email protected]\h:\w ] $ "
After pressing enter your BASH prompt will look like this.
[Mon Apr 28 14:04:48 [email protected]:/cygdrive/e/myfiles/] $
I used this command on Cygwin running on Window XP. The hostname and current directory will be different in your case.

Current working directory in BASH

For all those newbies in the world of Linux here is a very useful linux command.

[[email protected] practice]# pwd
/home/ravi/windows/d/myfiles/tutorials/c++/practice

pwd will print the current working directory in the konsole.

fdisk in fedora 8

I installed Fedora 8 last week on my computer. After installation I wanted to mount one windows FAT32 partition, before mounting the partition I fired fdisk command to check the partition letters. To my surprise fdisk command was not there!

But there was nothing to worry about. I found this tool icommand /sbin/ folder

So if you are using fedora 8 and want to use fdisk then use....

/sbin/fdisk

uname - print system information

If you want the know your system information like the Kernel name, Kernel Release, Kernel Version etc then you can issue uname command.

Here is the details of the command along with the arguments. This information is fetched from manual pages.

NAME
       uname - print system information

SYNOPSIS
       uname [OPTION]...

DESCRIPTION
       Print certain system information.  With no OPTION, same as -s.

       -a, --all
              print all information, in the following order, 
              except omit -p and -i if unknown:

       -s, --kernel-name
              print the kernel name

       -n, --nodename
              print the network node hostname

       -r, --kernel-release
              print the kernel release

       -v, --kernel-version
              print the kernel version

       -m, --machine
              print the machine hardware name

       -p, --processor
              print the processor type or "unknown"

       -i, --hardware-platform
              print the hardware platform or "unknown"

       -o, --operating-system
              print the operating system

       --help display this help and exit

       --version
              output version information and exit


5.1 Sound on Fedora 7

I am using Linux for so many years now but I also keep windows installed on my PC. I need windows just for one damn single thing, 5.1 sound! I was never able to enable 5.1 on fedora. I have been searching on internet, sending mails to mail groups and asking every other Linux geek but none helped. I guess today is my lucky day :)

I came across this page on the internet ALSA Multi-channel Audio mini-HOWTO by Uday Bondhugula. I followed the instruction given by him on this page. After following each and every step carefully I was able to get all my 5 speakers and Sub-woofer working!! But when I ran speaker-test -c 6 -D surround51 command I realized that my center and LFE speakers are actually swapped :( then I quickly mailed Uday asking for help and not hoping for his reply. To my surprise he replied soon (God bless you Uday) and asked me to run cat /proc/asound/card0/id command. He then asked me to make the changes in my /etc/alsa/cards/ATIIXP.conf file. Actually earlier I was struggling with /etc/alsa/cards/ICH4.conf file.

Now everything is great. I can hear sound from all my speakers on fedora 7. I am using MSI RS480-IL motherboard. Which has an on-board sound card.


If you find any difficulty enabling 5.1 on your Linux then let me know. May be I can help you :p

Happy Dolby!!

Enable Clean URL in Drupal

Step 1

Create a .htaccess file in your website's root directory and place the following code in it.

RewriteEngine on RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Step 2

Login to the Admin section of your Drupal site and enable the Path Module.

Path-Module

Step 3

Run a clean URL test and enable the Clean URLs.

enable-Clean-URL

Now you should be able to see the search engine friendly URLs :)

uptime - Tell how long the system has been running

uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

$ uptime
09:44:28 up 1 day, 1:10, 1 user, load average: 0.00, 0.00, 0.00

Reset forgotten MySQL root password

If you have forgotten your MySQL root password then don't worry. You can reset your lost password. Here is the procedure.

1. Login as root.

2. Kill running MySQL process and stop the MySQL service.

[[email protected] root]# killall mysqld
[[email protected] root]# /usr/libexec/mysqld -Sg --user=root &

3. Restart MySQL server with these parameters

[[email protected] root]# mysqld --skip-grant-tables --user=root

4. Manually set root password in the table "user" of "mysql" database.

[[email protected] root]# mysql

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.41
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> USE mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

mysql> UPDATE user
-> SET password=password("newpassword")
-> WHERE user="root";

Query OK, 2 rows affected (0.04 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit;

[[email protected] root]# killall mysqld

5. Restart MySQL again

[[email protected] root]# /etc/init.d/mysqld start

Now your root password is set and you can now login as root using the password you have just created.

[[email protected] root]# mysql -u root -p
Enter Password: "newpassword"

If you again forget your root password don't worry just check this link again :)

How to configure MySQL

By default the root password for MySQL is blank, but it is not safe.

Set the root password by entering the following in terminal.

mysqladmin -u root -p password 'password'

This will set the root password.

Now you can login to the MySQL using the password you have just created.

mysql -u root -p

This will ask you for the root password, just enter the password to access the MySQL console.

Serial Mouse in Linux - Get it working

If your serial mouse is not working in Linux then do the following steps.

1. Go to Terminal.
2. Login as root.
3. Open /etc/X11/xorg.conf file in your favorite editor.
4. Under the mouse section change the following.

"Device" "/dev/ttyS0"
"Protocol" "Microsoft"

5. Restart your computer.

Syndicate content