5 Linux partitions
To show linux partitions: use /sbin/fdisk
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6435 51689106 83 Linux
/dev/hda2 6436 10259 30716280 83 Linux
/dev/hda3 10260 14083 30716280 83 Linux
/dev/hda4 14084 14593 4096575 5 Extended
/dev/hda5 14084 14593 4096543+ 82 Linux swap / Solaris
Command (m for help): q
To view current filesystems and their corresponding mount point
vi /etc/fstab
vi /etc/mtab
6 How Do I mount a windows share on linux
via fstab : add the following line to your /etc/fstab [BY]
//yourserver.yourdomain.com/storage /fileserver cifs rw,user,username=Administrator,password=xxxxxx 0 0
via command line
mount //winserver/public /mnt/public -t smbfs -o username=kim,password=foo -o gid=users,dmask=777,fmask=777,rw
You may need to try between smbfs and cifs on different systems
7 How to setup TwinView (Dual Head, Dual Monitor) on Fedora Core 4
7.1 Setup
This procedure will surely work on the following setup, but it could work on other environments
Fedora core 4, kernel 2.6.14
GeForce 6600 video card (with dual head support)
Double Samsung SyncMaster 214T digital flatpanel monitors
7.2 Step 1: wire up hardware
Read the manuals that came with the devices and hook them up
7.3 Step 2: download driver from nvidia website
download from here
7.4 Step 3: run the setup program
sh NVIDIA-Linux-x86-1.0-8178-pkg1.run
7.5 Step 4: Update your /etc/X11/xorg.conf
make sure the following line are in your device section:
Option "TwinView"
Option "MetaModes" "1280x1024,1280x1024;1024x768,1024x768"
Option "HorizSync" "DFP-0:40-70;DFP-1:40-70"
Option "VertRefresh" "DFP-0:60;DFP-1:60"
7.6 Step 5: Check
If something went wrong, [RTFM:ftp://download.nvidia.com/XFree86/Linux-x86/1.0-7167/README.txt]
8 How to mount ntfs file system (a windows hard drive)
First check to make sure you have ntfs support by running the following commands as root:
/sbin/depmod
/sbin/modprobe ntfs
If everything goes on well, then move on. If you see error messages, reinstall kernel to enable
ntfs.
Then use fdisk -l to check the device name of your hard drive:
[root@localhost etc]# /sbin/fdisk -l
Disk /dev/hda: 40.0 GB, 40037760000 bytes
255 heads, 63 sectors/track, 4867 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 4736 38041888+ 83 Linux
/dev/hda2 4737 4867 1052257+ 82 Linux swap / Solaris
Disk /dev/hdb: 80.0 GB, 80054059008 bytes
255 heads, 63 sectors/track, 9732 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 9732 78172258+ 7 HPFS/NTFS
Create a directory to mount this hard drive:
mkdir /mnt/data
Now that you have the device name and target directory, mount it:
/sbin/mount -t /dev/hdb1 /mnt/data
Or you could choose to use linux-ntfs module .
9 How to recompile the kernel
First get a copy of the latest kernel source code from ftp://ftp.kernel.org/pub/linux/kernel/,
decompress it, and move the whole source code directory to /usr/src/.
Go into the source directory, run make menuconfig, and then make.
cd dir_name
make menuconfig
make bzImage
make modules
make modules_install
make install
vi /etc/grub.conf
10 How to setup static ipaddress?
The easiest way is to use
network setup system-config-network
which ever presents on your system.
If you cannot find either of these on your system, ifconfig can help you temporarily change you network setup
ifconfig eth0 xxx.xx.xx.xx
The problem with ifconfig is that your setup is gone once your restart you system. To make permanent changes to your network setup, edit
/etc/sysconfig/network/ifcfg-YOURINTERFACENAME
For example[YL] , put the following content in the file to use static IP address
DEVICE=eth0
BOOTPROTO=static
BROADCAST=XXX.XXX.XXX.255
IPADDR=XXX.XXX.XXX.XXX
NETMASK=255.255.255.0
NETWORK=XXX.XXX.XXX.0
ONBOOT=yes
or use the following to setup dhcp:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
11 how to setup my screensaver in GNOME
gnome-screensaver-preferences
12 How to set up dns server
/sbin/chkconfig named on
13 How to change time zone?
$ su
$ ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
14 How to setup network time sync server?
[root@bigboy etc]# /sbin/chkconfig ntpd on
[root@bigboy etc]# /sbin/chkconfig --list ntpd
[root@bigboy etc]# /sbin/service ntpd restart
15 How do I add a second disk?
/sbin/fdisk /dev/sdb use n to add a new partition, w write and exit
/sbin/mkfs /dev/sdb1
mount -t ext3 /dev/sdb1 /disk2 (or add a row in /etc/fstab)
16 How do I use X on my windows?
Install x-win
On your remote linux: export DISPLAY=your.local.windows.address:0.0
Start x app on your remote computer
17 What's the difference between nfs and samba?
Usually, if you want to share disk between windows and linux, use samba. If you want to share disk between linux systems, use nfs.
18 I am using vi, how do I disable auto wrapping?
:set set textwidth=0
19 How to enable auto login on linux?
http://www.linfo.org/automatic_login.html For gnu desktop, use gdmsetup.
If you prefer command line, look for /etc/gdm/custom.conf, under [daemon] session, add the following
AutomaticLoginEnabled=true
AutomaticLogin=your_user_name
20 How do I setup global variables?
Use either /etc/profile or /etc/rc.local, in my case, /etc/profile worked fine
21 How do automatically run programs after a GDM autologin?
Put your commands in "/etc/gdm/Xsession"
22 cannot restore segment prot after reloc
SELinux is prevent you from running IDL. This can be resolved by either of the following two solutions [IV]
*Change the default security context for IDL by issuing the command:
chcon -t texrel_shlib_t /usr/local/rsi/idl_6.1/bin/bin.linux.x86/*.so
* Disabling SELinux altogether by setting the line
SELINUX=disabled
in your /etc/sysconfig/selinux file.
23 How to setup timezone in linux?
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime ([wikihow]
24 boot scripts
http://www.atnf.csiro.au/people/rgooch/linux/boot-scripts/
Note that in linux startup scripts, a function return 0 for success and non-0 for failures.
25 Error while loading shared libraries: libfuse.so.2
check /etc/ld.so.conf for a line containing '/usr/local/lib'. If it's missing, add it, and run ldconfig afterwards
26 Ubuntu: Root login not allowed
This happens when you try to login in as root via GUI, you need to (1) remote logon from a console, or (2) somehow mount the harddisk to another linux and update /etc/ so it boots into console
Then, if you still want to enable root login via GUI, do the following
Login as a regular user
su
Option 1: run gdmsetup -> Security -> allow local admin login
Option 2: edit /etc/gdm/gdm.conf or gdm.conf-custom, set AllowRoot = true
27 How to set runlevel in Ubuntu?
/etc/event.d/rc-default
28 How to setup network on gentoo?
/etc/conf.d/net
To change host name, edit /etc/env.d/01hostname and /etc/conf.d/hostname
29 How do I mount an LVM on Ubuntu?
$apt-get install lvm2
modprobe dm-mod
vgscan
vgchange -ay VolGroup00
lvs
mkdir /tmp/aaamount /dev/VolGroup00/LogVol00 /tmp/aaa
30 How do I add a user to a specific group?
If it's a new user "useradd -G ftp tony". Otherwise use "usermod -a -G ftp tony"
31 How do I autologin a user in gdm?
Edit /usr/share/gdm/default.conf, locate and update the following section:[GC]
[daemon]
# Automatic login, if true the first local screen will automatically logged in
# as user as set with AutomaticLogin key.
AutomaticLoginEnable=true
AutomaticLogin=username
Edit /etc/gdm/custom.conf, locate and update the following lines:
AutomaticLoginEnable=true
Note that username cannot be root.
32 What's the initial ubuntu root password?
use "sudo passwd root" to init password
33 How do I install x on linux
apt-get install xorg
34 How do I kill a process by name
killall -9 process-name
on a side note, kill -9 only kills by process number
35 How do I install fuse?
Easiest way: yum isntall kernel-devel [DH]
36 I am using Redhat Enterprise RHEL, and yum doesn't seem to be working, what do I do?
Register with redhat network (RHN) and see if that helps.
37 How to change hostname?
vim /etc/sysconfig/network
/sbin/service inetd restart
38 I think I have the correct host:/path and mount-point, why cannot I mount an nfs share?
Check and make sure that portmap and netfs services are on.
If you get error "pmap_getmaps rpc problem: RPC: Unable to send; errno = Operation not permitted?", Check and make sure you firewall is off
39 Where's my lsof? I am using Redhat, and yum shows lsof as installed
/usr/sbin/lsof
40 Failed to mount NFS share, reason given by server: Permission denied
Check /var/log/messages on the server for more details.
41 How do I create an ext3 file system?
First use fdisk to create a partition, and then use mkfs.ext3 /dev/sdxx to format file system
42 I just bought a new disk, how do I create and export a file system as NFS share?
Add the new disk to your system
Boot up your system, check /dev/sdxx or /dev/hdxx for your newly added disk. Use /sbin/fdisk /dev/sdx as necesary. Suppose it is /dev/sdc.
/sbin/fdisk /dev/sdc, use n to create a new partition, write partition tables back to disk with w command, q to quit
/usr/sbin/mkfs.ext3 /dev/sdc1
Add the following line to your /etc/fstab: /dev/sdc1 /nfs-share ext3 defaults 0 0
Add the following line to your /etc/export: "/nfs-share 10.111.0.0/255.255.0.0(rw)". By having this ip pattern, anybody from 10.111.x.x can access your share read and write
/sbin/service nfs reload (/sbin/service/nfs start if it's not started already)
On your client, use the following to mount the share: mount -t nfs your.server.name:/nfs-share /mount/point
43 I am using redhat and I got this error: Abuse of service deteced for server xxxx
Try to re-register your rhn setup with rhn_register.
44 How do I create an ext2 file system?
Use fdisk to create a new partition, then use mkfs.ext2 to format file system.
45 How do I create a non login user?
adduser, then edit /etc/passwd, point shell to /sbin/nologin
46 How do I create a restricted user?
cd /bin
ln -s bash rbash
Add /bin/rbash to /etc/shells. Then edit /etc/passwd to point to /bin/rbash instead of /bin/bash.
47 Cannot determine the version of the linux kernel source?
If this happens when you are installing fuse on rehdat 4, then run "up2date -f kernel-devel", and then run fuse "configure --with-kernel=/usr/src/kernels/xxxxx/"
48 Using Ubuntu, how do I install g++?
sudo apt-get install build-essential
49 I am trying to install fuse on Redhat advanced server 4, configure/make/make install went on fine, however, I kept getting "module not found error" when I do modprobe
Locate that fuse.ko file, and try to insmod it. If you get compatibility error, do "uname -a" to check your kernel version, and make sure you have the correct kernel headers under /usr/src.
Not that kernel-devel and kernel-smp-devel are two different modules. If you have smp in your kernel, you'll need to "up2date kernel-smp-devel".
50 I lost my Ubuntu root password, how do I reset it?
Power cycle your system, press ESC at the grub menu, press e to edit grub, hight light the kernel line, and press e again. Add rw init=/bin/bash to the end of the line, and press b to reboot. You'll be in a root shell. Change passwords, and add new users as needed.
51 How do I change my locale in Ubuntu, for example to Japanese?
Edit /var/lib/locales/supported.d/local, and add your language, e.g., ja_JP.UTF-8 UTF-8.
dkpg-reconfigure locales
Edit /etc/default/locale and /etc/environment, and add these two lines "LANG=ja_JP.UTF8", and "LANGUAGE=ja_JP:ja".
Worked for Ubuntu 710.
52 pmap_getmaps rpc problem: RPC: Unable to send; errno = Operation not permitted
If you get this when trying to mount an nfs share, check the following: netfs service and portmap service are started? firewall is turned off?
53 My sles is complaining that my eth0 "start mode is manual"?
Check your /etc/sysconfig/network/ifcfg-eth0 and make sure it has the following line "ONBOOT=yes".
54 My sles take forever to boot
Go into failsafe (debug) mode and you'll see where sles got stuck. If it's at network startup, attach your harddrive to another computer, and remove all ifcfg-ethxxx under /etc/sysconfig/network
55 How do I share one of my folders with samba?
[export]
comment = Public Stuff
path = /your/path
public = yes
writable = yes
printable = no
create mask = 0777
Note that writable line gives access to everybody. If you can't create files from this share, you might need to chmod your shared directory?
56 How do I install software on suse?
Use /sbin/YaST -> software. Optionally, point repo to your local installation disk.
57 Mailman seems to be dropping my messages, however, I didn't see anything in the logs?
If you are sending messages to a maillist, remember that your mail goes thru your mail daemon first, for example, postfix. So you'll need to look at postfix logs at /etc/log/maillog. If still you don't see any useful logs, make sure your syslogd (or rsyslog) service is running properly.
58 How to batch resize image file
yum install -y ImageMagick, then use mogrify command
59 How to setup cron to run every 5 minutes?
Use
*/5 * * * * cmd
FG http://www.foogazi.com/2008/04/01/quickzi-how-to-set-cron-to-run-every-5-minutes/
60 How to batch rename files?
Batch rename 1.txt to 1.TXT
for file in `find . -name "1.txt"` ; do mv $file `echo $file | sed 's/\(.*\.\)txt/\1TXT/'` ; done
References [BY] http://kim.biyn.com/Linux/how_to_mount_samba_windows_shares_at_boot_time_via_fstab [CMU] www.cs.cmu.edu/~410/lectures/L20_Bootstrap.pdf [DH] http://devhen.wordpress.com/2006/06/08/howto-install-sshfs-on-centos-linux/ [GC] http://library.gnome.org/admin/gdm/2.20/configuration.html.en#daemonsection [IBM] http://www.ibm.com/developerworks/linux/library/l-linuxboot/ [IV] http://www.ittvis.com/services/techtip.asp?ttid=3092 [MM] http://www.dewassoc.com/support/msdos/msdos_memory.htm [T] http://www.isc.tamu.edu/~lewing/linux [YL] http://yolinux.com/TUTORIALS/LinuxTutorialNetworking.html#CONFIGFILES [[FPO] http://www.frontiernet.net/~fys/rombios.htm [wikihow] http://www.wikihow.com/Change-the-Timezone-in-Linux