twitter
    Find out what I'm doing, Follow Me :)

Hardware

How to list partition tables

fdisk -l

How to list filesystem disk space usage

df -T
  • You can also use K Menu -> System -> Monitoring -> KDisk

How to list mounted devices

mount

How to list PCI devices

lspci

OR

lspcidrake -vv

How to list USB devices

lsusb

How to speed up CD/DVD-ROM

  • This is assuming that /dev/cdrom is the location of CD/DVD-ROM
hdparm -d1 /dev/cdrom
kwrite /etc/hdparm.conf
  • Insert the following lines in the new file
/dev/cdrom {
dma = on
}
  • Save the edited file

How to mount/unmount CD/DVD-ROM manually, and show all hidden and associated files/folders

  • These operations may only be necessary in older versions of Mandriva; in the latest versions CD/DVD's are mounted automatically, or it can be done via the menu when right clicking in the file manager (e.g. konqueror).
  • This is assuming that /mnt/cdrom0/ is the location of CD/DVD-ROM
  • To mount CD/DVD-ROM
mount /mnt/cdrom0/ -o unhide
  • To unmount CD/DVD-ROM
umount /mnt/cdrom0/

How to forcefully unmount CD/DVD-ROM manually

  • These operations may only be necessary in older versions of Mandriva; in the latest versions CD/DVD's are mounted automatically, or it can be done via the menu when right clicking in the file manager (e.g. konqueror).
  • This is assuming that /mnt/cdrom0/ is the location of CD/DVD-ROM
umount /mnt/cdrom0/ -l

How to remount /etc/fstab without rebooting

mount -a

How to create Image (ISO) files from CD/DVD

  • This is assuming that /dev/cdrom is the location of CD/DVD-ROM
umount /dev/cdrom
dd if=/dev/cdrom of=file.iso bs=1024

How to create Image (ISO) files from folders

mkisofs -o file.iso /location_of_folder/

How to mount/unmount Image (ISO) files without burning

  • To mount Image (ISO) file
mkdir /home/uid/iso
modprobe loop
mount file.iso /home/uid/iso/ -t iso9660 -o loop
  • To unmount Image (ISO) file
umount /home/uid/iso/

How to create an emergency boot disk

How to make a bootable CDRom - as an alternative to, or in addition to a bootable floppy disk.

As it is sometimes difficult to fit a modern kernel on a floppy, and because more and more machines do not have a floppy drive at all, it is usually a good idea to have a bootable CDRom if for any reason your machine does not seem to be able to complete the boot process by itself. The following describes the steps to make a bootable CDRom containing the kernel that is running at this time.

It should be borne in mind that when actually using the Boot CD in case of need, some operations require the presence on the system of files relative to the kernel that is on the CD. In other words, the best possible boot CD is one for a kernel that is actually installed on the system. When upgrading or adding another kernel to your system, it is advisable to make a new boot CD. When you are already satisfied that the newest kernel does everything it should with your hardware, you can use a CDRW and burn the bootable CD over an older kernel. If not, a separate disk is advisable.

Steps to take:

Start any console or terminal.

Give the commands shown:

su # to become root; enter root password when prompted
cd /tmp # some temporary files will be created here

Insert a blank, writable CDRom or a fresh, unformatted CDRW. In my experience it is best to check that the disk has not been automounted or 'supermounted':

umount /mnt/cdrom0 # change 'cdrom0' as needed ¹)

(Skip for cdrom): Blank any CDRW with the following command (or with your preferred burnware):

cdrecord blank=fast dev=/dev/hdc

in which '/dev/hdc' is the mount point of the CDwriter, change as needed ¹)

Create the ISO file or 'image' from the currently running kernel, that will be needed to burn to disk later
mkrescue --iso
Or: create an ISO file from any kernel on your system, other than the one currently running
mkrescue --image LABEL --iso

in which you must replace 'LABEL' with the label name as it appears in your /etc/lilo.conf . For example if your lilo.conf contains the line: label="linux-2.6.10-1.mm.18" in the paragraph describing the kernel that you want to make a bootable cd from, you should use the command:

mkrescue --image linux-2.6.10-1.mm.18 --iso

Burn the image to disk:

cdrecord speed=16 -eject dev=/dev/hdc rescue.iso

in which /dev/hdc is an example; change to same as above ¹); 'speed' may be changed to a proper number for your burner and -eject is not necessary, but I believe a burned disk can better cool off outside than inside the box :)

Remove the temporary files from your hard drive (not needed if your system is set to remove temp files).

rm rescue.iso
rm mkrescue-flp/boot.bin
rd mkrescue-flp
exit # to return to being user.

¹) Usually the easiest way to remind yourself which is which is to insert a finished CD in the drive and give the command: "df" and/or "grep cd /etc/fstab"

User Administration

How to set/change/enable root user password

[amrina@localhost~]# passwd root

How to disable the root user account

  • Please think twice before doing this: it can get you into serious trouble
[amrina@localhost~]#passwd -l root

How to switch to root user in Console mode

[amrina@localhost~]#su
[amrina@localhost~]#Password:

How to add/edit/delete system users and groups

[amrina@localhost~]#useradd
syntax : useradd [options] LOGIN

Options:
  • -d home directory
  • -s starting program (shell)
  • -p password
  • -g (primary group assigned to the users)
  • -G (Other groups the user belongs to)
  • -m (Create the user's home directory

Example: To add a new user with

  • a primary group of users
  • a second group mgmt
  • starting shell /bin/bash
  • password of xxxx
  • home directory of roger
  • create home directory
  • a login name of roger
#useradd -gusers -Gmgmt -s/bin/shell -pxxxx -d/home/roger -m rogerv


userdel - Deleting a user              

Options:

  • -r (remove home directory)

Example: To remove the user 'roger' and his home directory

userdel -r roger

Modifying existing user 
[amrina@localhost~]#usermod

Options:

  • -d home directory
  • -s starting program (shell)
  • -p password
  • -g (primary group assigned to the users)
  • -G (Other groups the user belongs to)

Example: To add the group 'others' to the user roger

[amrina@localhost~]#usermod -Gothers roger

How to change files/folders ownership

[amrina@localhost~]#chown system_username /location_of_files_or_folders

How to change files/folders group ownership

[amrina@localhost~]#chgrp system_groupname /location_of_files_or_folders


How to remove Installation CDs from media list

[amrina@localhost ]# urpmi.removemedia Installation Free CD