Tips n Tricks for Linux

Status
Not open for further replies.

QwertyManiac

Commander in Chief
one trick to remove linux boot menu, install osl2000 boot manager and uninstall it immeadiately, thats it MBR fixed ! (remove the hdd data using windows disk manager).

Hahahaha

I like linux but follow this for removing it to install some other linux version and just for throwin myself in to trouble. :lol:
 

ujjwal

Padawan
If you are concerned about speed of applications (using shared libraries) under linux (especially load time), you will surely be interested in prelinking.

*www.crast.us/james/articles/prelink.php
*www.celinuxforum.org/pubwiki/moin.cgi/PreLinking
 

Vishal Gupta

Microsoft MVP
Guys! I'm not an expert in Linux, but I hv some Tips-n-tricks for it, which I hv collected from Many DIGIT issues, websites and some from my own experiences. Here I'm sharing them.
Many of them may be already discussed or u guys already know them, but I'm putting some of them here. May be these can help some members:

1.) To access FAT partitions in Red hat linux:

Open /etc/fstab file and append following lines:

/dev/hda1 /mnt/C vfat defaults 0 0
/dev/hda5 /mnt/D vfat defaults 0 0
/dev/hda6 /mnt/E vfat defaults 0 0

NOTE: Here hda1 denotes C: drive, hda5 denotes D: drive, similarly hda6 for E: drive and so on...
C, D and E are the directories name, which u hv to create in /mnt directory, it can be any names.
Remember to add an extra line at end of this file!

2.) To enable / disable services to be start at system startup:

In Console, type Setup.

3.) To configure GRUB loader:

U can edit /etc/grub.conf file to change settings of GRUB loader.

4.) To enable 32-bit I/O of Hard Disk:

In console, type hdparm -c1 /dev/hda

5.) To enable DMA of Hard Disk:

In console, type hdparm -d1 /dev/hda

6.) To see messages that r displayed at boot time:

In console, type dmesg

7.) To crate Rescue Disk:

In console, type mkbootdisk <kernel_version>

8.) To set <ctrl>+<alt>+<del> working in Linux:

Open /etc/inittab file and append following line:

ca:ctrlaltdel:/sbin/shutdown -t3-r now

9.) To change SPLASH screen of KDE:

Goto: /usr/share/apps/ksplash/pics directory, here u'll find some PNG files, u can edit them for ur desired result.

10.) To change SPLASH screen of GNOME:

Goto: /usr/share/pixmaps/splash directory, here u'll find some image files, u can edit them for ur desired result.

11.) Location of Login screen of GNOME:

Goto: /usr/share/gdm/themes directory, here u'll find Directories, which contain different Login screens images, that u can set into Control Panel. Here u can also add ur cutom Login screen or can edit existing!

12.) To reinstall GRUB Loader:

Boot using Linux Setup CD, and type Linux Rescue at terminal, then after some steps u'll enter into console, here first type:
/mnt/sysimage, and then type:
grub-install /dev/hda
Now u can exit from console...

ENJOY!!!
 

QwertyManiac

Commander in Chief
@vishalgupta
Cool Post man, thnx for the one place stop shop for a lot of tricks or tips...
Keep it UP up and above...
 
dos shortcuts

hi all,


those who are tired of windows and crossover to linux and firstly try console may try the dir command at first. even though we get the same as windows but ls more powerful than that one.

by mistake also u try dir instead fo ls. to get rid of it simply follow this steps and even if u type dir u will get the power of ls. try this for some of your commands as and alias.

for ls:

open vi editor with the file name 'dir';
type ls in the first line and save and exit.
them chmod dir 777 to make the file executable.
then copy/move the file into /usr/bin directory or the user bin diractory.

and when ever u type dir you will execute the ls command itself. and do same for your favourite commands until u adictacted to the console commands.
 

praka123

left this forum longback
For gnome esd sound problems;i simply do this:

Code:
$gconftool-2 --type boolean --set /desktop/gnome/sound/enable_esd false
My 2Cents :wink:
 

praka123

left this forum longback
Many are irritated my newer GNOME nautilus not opening as browser interface,if u double click on icons.hmm....i am not 100% sure but u can try opening nautilus always as browser by
Code:
prakash@debian:~$ gconf-editor
in gconf GUI browse to apps>nautilus>preferences>tick 'always_use_browser' .
that's it.I tried with my RHEL 4 and DEbian SArge and got it working.
:wink:
 

desertwind

Cyborg Agent
A better way is open Edit>Preferences in nautilus.
Go to Behaviour tab and check "Always open in browser windows".
 

ujjwal

Padawan
If you are interested in console commands/tools which can make your work easier, the CLI Magic series from Linux.com will appeal to you -

*www.linux.com/search.pl?tid=89
 

desertwind

Cyborg Agent
Those who have trouble mounting windows partitions by editing fstab file, just install this rpm. it searches for fat/ntfs partitions in your system and mounts it automatically, and add entries to fstab.

*forums.pcquest.com/forum/files/mountpartitions-1.0-0.i386_953.rpm
 

shlok

Right off the assembly line
For protecting against local root hack [if you share your computer physically], following maybe useful [only for grub boot loaders]:
1. Make access to grub at boot prompt password protected. To do this -
a. login as root {su}
b. get grub shell {/sbin/grub}
c. grub> md5crypt
password: *******
Ecnrypted: #$%#$fewfwer34534^%$^%
grub> quit
d. Copy the encrypted string and put it into /etc/grub.conf as:
#====>
splashimage=(hd0,0)/grub/splash.xpm.gz
password --md5 #$%#$fewfwer34534^%$^%
title Red Hat Linux
#<=====
i.e. between Splash and Title.
e. Now your boot loader grub is password protected.

2. For further blocking of root access in single user mode, following can be additionally implemented. But a word of caution, this needs the root password to be remembered. It's a must. I think, even if someone removes hard-disk, it will not allow root access. I have not tried using boot-CD, if this can be bypassed. If someone tries, please post and let all know. Anyways, the method is as:
a. Login as root {su}
b. Include following line in /etc/inittab :
~~:S:wait:/sbin/sulogin
You can try tip [2.] even without enabling grub password protection. After above change, the system will always ask for root-password before login, even in single user mode. If not provided [Ctrl-D] it would simply enter multi-user graphical mode [run-level 5] or other default mode/run-level.
 

praka123

left this forum longback
Fonts on GDM login screen are too small

This happens to be a problem in many distros especially Debian and Ubuntu.
First need to get correct dpi (Dots per inch). for that issue:

Code:
prakash@ubuntu:~$ xdpyinfo | grep dimen
for mine it is a 15' Samtron 56V monitor:
root@ubuntu:/home/prakash/Downloads# xdpyinfo | grep dimen
dimensions: 800x600 pixels (212x159 millimeters)

get in inches:
212/10/2.54=8.346456693 =8.35
divide :
800/8.35=95.808383234 =96 dpi for mine (normally for most)

as root open any editor:
Code:
root@ubuntu:~# vi /etc/gdm/gdm.conf

go to the end of the file and get those lines starting as
"command=/usr/X11R6/bin/X....."
append the dpi to the end of the lines.
eg:
command=/usr/X11R6/bin/X -br -audit 0 -dpi 96
and as root

Code:
debian# /etc/init.d/gdm reload

thats it! fonts will be bigger :wink:
 

praka123

left this forum longback
For enabling COMPLETE bash completion features in UBUNTU/DEBIAN.(provided bash-builtin package already installed) run:
Code:
. /etc/bash_completion
in home dir.
or u can try this script in /home/xxx/.bashrc.(already in Ubuntu)
Code:
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profiles
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
. /etc/bash_completion
:D
 

praka123

left this forum longback
If YOU want to see the boot messages in b/w flashing rhrough ur screen at very high speed.U can try enabling bootlogd.remember though few distros got this working.In my debian Sarge GNU/Linux 3.1.I tried as below enabling bootlogs with 'Yes' Succeded
Code:
suryan:~# vim /etc/default/bootlogd
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=Yes
I learned from web that bootlogd needs to be started before udev for bootlogd to work.I manually changed as below
Code:
 mv /etc/rcS.d/S05bootlogd /etc/rcS.d/S03bootlogd
And I restarted and checked to sure that there is bootlog in /var/log/boot
So U may try this in Debian Sarge.I dont know if it works in Ubuntu etc..as this essentially is a Hack :)
My eg:
Tue Jan 24 20:59:31 2006: bootlogd.
Tue Jan 24 20:59:31 2006: Mounting a tmpfs over /dev...done.
Tue Jan 24 20:59:31 2006: Creating initial device nodes...done.
Tue Jan 24 20:59:31 2006: ^[%GSetting parameters of disc: (none).
Tue Jan 24 20:59:31 2006: Activating swap.
Tue Jan 24 20:59:31 2006: Checking root file system...
Tue Jan 24 20:59:31 2006: fsck 1.37 (21-Mar-2005)
Tue Jan 24 20:59:31 2006: /: clean, 143447/1330368 files, 884361/2660757 blocks
Tue Jan 24 15:29:31 2006: System time was Tue Jan 24 09:59:31 UTC 2006.
Tue Jan 24 15:29:31 2006: Setting the System Clock using the Hardware Clock as reference...
Tue Jan 24 15:29:33 2006: System Clock set. System local time is now Tue Jan 24 15:29:33 IST 2006.
Tue Jan 24 15:29:33 2006: Cleaning up ifupdown...done.
Tue Jan 24 15:29:33 2006: Calculating module dependencies... done.
Tue Jan 24 15:29:33 2006: Loading modules...
Best of LUX
 

Satissh S

Youngling
How to Recompile and install a new kernel.

How to Recompile and install a new kernel.
Recompiling and installing a kernel is often a fearsome experience for a linux newbie, here are easy to use (shampoo bottle) instructions for doing so.

1. Download the Linux kernel from the linux kernel website, currently Linux Kernel 2.6.12 (as of feb 2006)

*www.kernel.org

2. Extract the .Bz2 (BZip2) archive to /usr/src/, by doing the following.
Open a terminal, if you are in graphical environment or if it's your login shell, just continue.
Remember, You must be of group wheel to su in.

$ su
(root password)

# cd /usr/src
This moves you to /usr/src directory.

# tar -xvjpf <downloaded file location>/linux*.tar.bz2
This extracts the bz2 image to the /usr/src directory. Substitute the <downloaded file location> with the location of your file.
Now, we have to update the linux symlink for your earlier kernel to our new kernel source.

# rm linux

# ln -s linux-2.6.12* linux

this -s option instructs the ln command to create a symlink instead of a hard link. Make sure that the new link points to your new kernel.
Now, cd into directory and make the kernel.

# cd linux

# make menuconfig

This fires up a n-curses based menu that performs the kernel configuration. Here, I have nothing to do. Browse each option and take your time to fully read the help associated with each option. The commands lspci and lsmod can help you identify hardware info if you have installed pciutils package. Additionally you can also view boot messages for help, using dmesg. You can either compile stuff into the kernel using brutal compilation or compile stuff as modules in a more subtle way.

A few keystrokes to help you,
[Enter] --> Activate Current Item
[Esc] --> Go backwards
[Tab] --> Toggle through the interface.
/ --> Search
? ([shift] + /) --> Help for the associated item.
With item Selected,
Y --> Compile into kernel
N --> Donot Use the Item in the kernel.
M --> Compile as Module which you can insert, remove using insmod, modprobe commands.

Sometimes it opens up a submenu there you can either walk around using Arrow keys and select the stuff or type if it's a text input box.

After doing all your work, Go to the top most hierarchy and select [Exit] and select [yes] to save your config.
After you are dropped in the terminal, do the following.

# make

# make modules_install

This creates a hot new bz kernel for you to use. Copy it to the /boot partition using the following commands.

# cp arch/i386/boot/bzimage /boot/newkernel

Now, update your boot loader for booting with the new kernel, for example create new section in /boot/grub/grub.conf or in /boot/grub/menu.lst as,

# emacs /boot/grub/grub.conf

title newkernel26
root (boot partition in boot loader lingo) // Example (hd0,0)
kernel /boot/newkernel root=/dev/hda* (your root partition)

Save and close.
Now, you can boot your new kernel from the boot time. Enjoy Linux!! :)

Edit: a small mistake corrected. ;)
 

desertwind

Cyborg Agent
Wow! Thats a clean and lean tutorial. Must be a great help for n00bies.

I got this information from the cinelerra documentation.

SPEEDING UP THE HARD DRIVE

This is a very popular command sequence among Linux gurus, which is not done by default on Linux distributions.

Code:
$ hdparm -c3 -d1 -u1 -k1 /dev/hda

-c3 puts the hard drive into 32 bit I/O with sync. This normally doesn't work due to inept kernel support for most IDE controllers. If you get lost interrupt or SeekComplete errors, quickly use -c0 instead of -c3 in your command.

-d1 enables DMA of course. This frees up the CPU partially during data transfers.

-u1 allows multiple interrupts to be handled during hard drive transactions. This frees up even more CPU time.

-k1 prevents Linux from resetting your settings in case of a glitch.
 
Status
Not open for further replies.
Top Bottom