Linux Tips
Useful Commands
uname
use this to find the current kernel revision and processor type, as well as other information
ldd
ldd
filename: shows library dependencies for the executable/library specified by
filename
nm
list symbols from library
ntpdate / sntp
ntpdate hostname: synchronizes time with hostname -- outdated on most systems, on opensuse use 'sntp -P no -r hostname' instead
Important Files
fstab
Defines mounted disks and other media
inittab
Defines runlevels, allows specification of the runlevel to start in. This is useful when you don't want to automatically start the X GUI.
chroot
Changes the root directory, such that a mounted drive could seem like root. For instance, if I mounted a harddrive at /mnt/sda1, 'chroot /mnt/sda1' would put me in a shell where that drive seemed like the root drive.
ifconfig
Allows network interfaces to be brought up and down, allows setting static IP addresses and modifying the MAC address of an interface.
ifup
Allows release/renewal of DHCP-assigned IP addresses, like windows's ipconfig /release or /renew
How To...
Restore a corrupted MBR with GRUB
- Boot the machine using a live linux version such as knoppix
- you might want to make sure the live CD is for the same architecture as your machine (at least 32 or 64 bit)
- Mount the drive
Check if a disk/file system has been corrupted
- The file system has to be unmounted, so if it's the root partition, you'll have to boot using a live CD distro. Otherwise, just make sure the drive is unmounted.
- Run fsck on the drive, ie fsck /dev/sda2
Spoof a MAC address
ifconfig eth# down
ifconfig eth# hw ether ##:##:##:##:##:##
ifconfig eth# up
DHCP
use the commands ifup, ifdown, ifstatus
--
SamPreston - 28 Apr 2007