Tips n Tricks for Linux

Status
Not open for further replies.

khandu

In the zone
Hi All..

I just hope the MODS make it a sticky and every1 adds tips n tricks in this post..

Many will be already knowin these but i m startin this just for the TOTAL NEWBIES!!!

1) HOW TO INSTALL RHN directly from ISO ( JAN 2005 DVD )


  • Copy all the ISO in a folder.. ( CANNOT BE A NTFS file system.. Should be a FAT32 System )
    Use a RW and burn the rescued CD ISO into it
    For Floppy ppl, you will have to make a bootable floopy
    Boot from it and then type " linux askmethod"
    Then choose "From Hard Disk" and then give the path..
    Rest is same

More will be coming soon... 8)
 

klinux

Ambassador of Buzz
weird , sounds so familiar : *www.thinkdigit.com/forum/viewtopic.php?t=14097 ;) . anyways good thread .
 

GNUrag

FooBar Guy
This could be a good start. I would recommend the level of complexity to a bit lower.

One can also go to the LOST project's homepage and have a lots of LOSTs from there. Its also available in fortune format.
*lost.sourceforge.net

I'd try to post something from freebsd fortune cookies..

TIP:
If you `set watch = (0 any any)' in tcsh, you will be notified when
someone logs in or out of your system.
 
OP
K

khandu

In the zone
2) HOW TO RESET UR ROOT PASSWORD IF U FORGET IT

Code:
While Booting ( Redhat )   just press "e" in GRUB 
u will find 3 lines of code.. 
Goto to the 2nd line press "e"again and type "1" in the end
 then press ENTER.. 
Then press "b" and it will boot you into your shell.. 
Just type "passwd" and change ur ROOT password... 
dont need to know the old one..


Cool na.. :p
 

tuxfan

Technomancer
Source: LinuxForYou, June 2004

Q. I am doing a project on Linux platform. Someone has added the GRUB password to the computer on which I am working and has also changed the root password. I can crack the root password, if there is no Grum password, from the initial screen (i.e. from the init 1); but with the GRUB password. While reading LinuxForYou, I saw your section and thought you may be able to help.



A. To break the GRUB start-up password, follow the steps given below:

1. Boot the system with the first Linux CD. At the boot prompt, type linux rescue to switch to rescue mode. In rescue mode you will be asked if similar steps should be followed, which need to be followed in the installation. Once you get the # prompt, type the following command:

# chmod /mnt/sysImage

2. Edit the grub.conf file and remove the passwd line from the file. Save the file and exit.

3. Once your machine reboots, you will be able to start your Linux OS in the usual manner.



Source Digit, June 2004

"I, uh, forgot the root password"



Let's look at recovering the root password from the boot loader. If you're using GRUB, then, as GRUB loads up, highlight the Red Hat Linux entry on the GRUB menu and then press [E] to edit the boot configuration. Locate the following line, something that looks like this:



kernel /boot/vmlinuz-2.4.20-0.70 root=LABEL=/hdc=ide-scsi



Type the number '1' at the end. Doing so boots the PC into run level 1-single user mode, where you're automatically logged in as root. This done, type 'passwd' at the prompt. You can enter a new password here.



...............................................



Remember that since it's so easy to recover a boot password, you need to physically secure your machine if you don't want someone else using your computer as root.
 

firewall

In the zone
How to restore GRUB

It's happened to almost every GNU/Linux and Windows dual boot user at some point: You have a nice installation GNU/Linux cross-booted with Windows. So far so good. But then, at some point, you reinstall Windows, perhaps because you upgraded to a new version, or perhaps you just did it to "clean up" Windows, reinstalling the original system files to make it a little more stable. When you reboot, however, you'll find that if you had LILO running from your hard disk's MBR, it has been killed, and Windows has claimed the MBR as its own. How will you reinstall your boot manager so you can get into GNU/Linux?

here is small tutorial on how to reinstall your gnu boot loader in that case. I chose GRUB here as now a days it's very popular and powerful too. For those who use LILO, check out my next post ;)

----

Boot into the rescue mode using install CD1 by typing "linux rescue" at the boot prompt. When it asks you if you want it to find your installation and mount it, let it by selecting "Continue". Once you get to the sh prompt chroot into you installation with:

# chroot /mnt/sysimage

If the disk you boot from is /dev/hda then you should be able to reinstall grub with:

# grub-install /dev/hda

Just remember to exit the chroot'ed shell before you reboot. If you reboot by "Ctrl-Alt-Del" the installer will unmount your partitions. Although it probably wouldn't hurt to try to unmount as many as you can yourself with something like:

# umount /dev/hd?[1-9]*

----- :)
 

firewall

In the zone
Restoring LILO

Here is the process :::::

you just need to reinstall LILO. That means you have to boot into Linux some other way. Use the First CD of ur distro and go to repair option. At the command prompt just type /sbin/lilo. You should get a response that looks like this:

Added linux *
Added win

The asterisk (*) indicates the default boot image. (If you see anything other than this, something went wrong. Go back through your lilo.conf and read the man page to see what it was.) When you reboot, LILO will be back where it belongs!
 

GNUrag

FooBar Guy
If you want df(1) and other commands to display disk sizes in
kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
environment to 'K'. You can also use 'M' for Megabytes or 'G' for
Gigabytes. If you want df(1) to automatically select the best size
then use 'df -h'.




Over quota? "du -s * | sort -n " will give you a sorted list of your
directory sizes.
 

firewall

In the zone
Internet sharing using IPTABLES

Scenario : There are two pcs. one is connected directly to internet and you wish to have another one too.
You can use Squid - Proxy for that. But there is another smart way to do the same. yes use, IPTABLES !


:) here is how.....

You need to have "rOOt access.

1) edit the file:
/etc/sysctl.config
add a 1 to the ip_forward like so:

net/ipv4/ip_forward = 1

save and close file.

2) at the prompt type:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Then at the prompt again type:

/etc/init.d/iptables save
or
service iptables save

Restart the network services, like so:

/etc/init.d/network restart
or
service network restart

All this is done on the firewall machine.

The eth0 is the network interface pointing to the Internet not your local network

This will let all pc on the local net to get online and the main pc will masquerade the internal IP address to look like the request is comming from the firewall pc.

:) enjoy....
 

firestarter

Broken In
DEfault Desktop Envirinment Switcher

What will be your default desktop when you boot next time.

Open the terminal and firein
Code:
switchdesk GNOME
or
Code:
switchdesk KDE

Or you can manually edit the following file and put your prefered environment
Code:
vi  /etc/sysconfig/desktop
and put
DESKTOP="KDE/GNOME"
 

pradeep_chauhan

Cyborg Agent
Guys all of us use a terminal for work in linux. I located a beautyful cute and well behaved terminal called Eterm. Its small and very eye catchy. Its also highly configrable. Try it out and you will forget konsole xterm gnometerminal or even aterm(my previous pal).
 

pradeep_chauhan

Cyborg Agent
Now Try this for a true cool effect
Eterm -g 60x10+10-10 -O -x --no-cursor -w 0 --scrollbar 0 --buttonbar 0 -e tail -f /var/log/messages &
 

firewall

In the zone
Know your Distribution Release Information

To know about your Redhat/Fedora info:

Code:
cat   /etc/redhat-release

To know about your Debian info:

Code:
cat   /etc/debian_version

To know about your SUSE info:

Code:
cat   /etc/SUSE-release

Feel free to add about other distros

:)
 

ujjwal

Padawan
For slackware

cat /etc/slackware-version

;)

Aliases

You can use shell for convenience, for example to set alternate names for certain commands, or to replace one command with another, like

alias more="less"

This will use the more featured "less" command in place of "more".

Note :- An alias set in this manner is temporary, and only holds for that shell session. To permanently set an alias, add it to an initialisation script in your distro (like ~/.bashrc).

Removing the fat

Linux can be run on a variety of old systems, but many new distro's are bloated up, and include loads of unneccessary stuff, which make them painfully slow to use.

Two excellent articles on reducing the bloat -

*users.netwit.net.au/~pursang/lofat.html
*users.netwit.net.au/~pursang/lofat2.html
 

pradeep_chauhan

Cyborg Agent
Guys
The new 2.6.11 kernel shipps with a range of new low level drivers please upgrade your kernel. To highlight this pont I have an Adaptec 39160 SCSI 160MBps adaptor in my home P3 machine earlier i was getting a throughput of roughly 49MBps from the disk Now with the new driver in the kernel 2.6.11 the throughput has gone up to 51.34MBps This performance improvement has made the system noticably faster.
Similarly there are other new drivers too.
 

ujjwal

Padawan
Using loadlin to boot into an installation image from your hard drive

You can install a linux distro directly from its installation image, incase you don't have a CD Writer.

If you have windows 9x or DOS installed (a DOS bootable floppy will do), you can use a tool called loadlin for this purpose.

I will take the example of slackware here ...

Download the slackware installation cd.

Create a directory called slackware or something in your DOS partition. View the image with any CD image viewer, and open the file loadlin16c.zip in the "kernels" directory (incase your distro doesn't ship with loadlin, you can download loadlin 1.6c from here), copy the file loadlin.exe to your directory. Also copy the following to that directory -

kernels/bare.i/bzImage
isolinux/initrd.img

Note - incase you need a feature present on a kernel other than bare.i, use that instead (ex - jfs.i if you want to use the jfs filesystem)

Boot into pure DOS mode and cd to the directory you created and type the following -

loadlin bzImage root=/dev/ram rw initrd=initrd.img

Your installation should continue as normal. Mount your dos partition in linux, and then mount the ISO linux in any directory ... say /source by the following command -

mount -o loop filename-with-full-path /source

Now, begin the installation as usual by typing "setup", and then when it asks you for the source of the installation files, just enter "/source/slackware".

Everything should be normal from here
 
Status
Not open for further replies.
Top Bottom