o-s

Linux System Administration Commands

October 1, 2010

Compression/decompression utilities (software installation):

compress <file>                      compress -d <file>.Z (or uncompress <file>.Z)

gzip <file>                                gzip -d <file>.gz (or gunzip <file>.gz)

tar cvf <device> <files>         tar xvf <device>.tar

System Shutdown:

reboot
halt
shutdown [-h now] [-r now]

User Management:

1.  To add a user

 (a) adduser: add a new user account

     (useradd, chfn, passwd)

  (b) /etc/passwd

2.  To delete a user:

(1)   userdel [-r]: delete his home directory and passwd entry

  • delete that user’s home directory: rm -rf /home/<user directory>
  • delete his /etc/passwd entry
  • delete his mail spool file: rm -f /var/spool/mail/<user file>

3.  To modify a user:

  (a)   Usermod <name>

  (b)   /et/c/passwd (& /etc/group)

Group Management:

1.  To add a group:

  (a)  Groupadd <group>

  (b)  /etc/group

2.  To delete a group

(1) groupdel <group>

3.  To modify a group

(1)  Groupmod [-n <group_name>] <group>

User Disk Spack Management:

quota [-v]

Mounting and Unmounting file systems:

mount [-t <fstype>] <device> <mount point>
umount <mount point or device>

<fstype>: minix, ext, ext2, umsdos, msdos, iso9660, nfs, proc, swap

Devices:

IDE, EIDE (ATAPI):

/dev/hda1, /dev/hda2, …

/dev/hdb1, /dev/hdb2, …

SCSI:

/dev/sda1, /dev/sda2, …

/dev/sdb1, /dev/sdb2, …

floppy:

/dev/fd0, /dev/fd1, …

Disk-related commands:

fdisk <device>
mkfs [-t <fstype>] <device>

File system recovery:

fsck <device>

Disk space:

du <directory>   : disk space usage

df       : disk free space

Monitoring system efficiency:

top     : show current process information

free   : show current memory information

Program development (or software maintenance):

GNU C/C++ compiler (gcc), GNU make, …

Rebuilding & Upgrading the kernel:

1.  Get the latest Linux kernel (2.2.x)

2.  Uncompress kernel source: tar zxvf

3.  Building the kernel:

cd /usr/src/linux

make config

make dep; make clean

make zImage (or make zlilo)

mv /vmlinuz /vmlinuz.old (if necessary)

cp /usr/src/linux/arch/i386/boot/zImage /vmlinuz (or any other file as specified in /etc/lilo.conf)

joe /etc/lilo.conf (if necessary)

/sbin/lilo

sync; sync; reboot

Linux installation:

(1)    get Linux package (Slackware)

(2)    Creating boot & root disks: (May be skipped if CD-ROM is bootable)

  • In DOS:

o  rawrite <disk image> <floppy disk>

  • In UNIX or Linux:
  • cat <disk image> > <device>
  • dd if=<disk image> of=<device>

(3)    boot from floppy disks (or CD-ROM)

(4)    fdisk <device> (if needed)

(5)    reboot

(6)    setup: start installing Linux…

(7)    X Window configuration: SuperProbe & xf86config à the most difficult!

LILO (Linux Loader) – a Boot Manager

  • Installing LILO:

/sbin/liloconfig    &nb

sp;   : set
up /etc/lilo.conf

/sbin/lilo                  : update boot sector, and create /boot/map

see LILO mini-HOWTO for more details

System configuration files:

/etc/inittab        : specify the programs to execute at each run level

/etc/fstab          : file system to mount

/etc/mtab          : last mounted file system

/etc/passwd      : user/password

/etc/motd          : displayed after logging in

/etc/issue           : displayed before logging in

/etc/rc.d/rc.*     : rc scripts executed at booting time

Documentation:

Man pages

/usr/doc/*

(/usr/doc/faq/*: for FAQ’s and HOWTO’s if they are installed)

/usr/src/linux/Documentation/*

LDP, CLDP, …

Home