Linux Cheat Sheet

From Linuxhelp Wiki

Author:Luke
Created On:December 8th, 2000
Updated On:February 1st, 2005

The following are a few helpful hints for working with a Linux system. For more descriptive guides, search the wiki.

Contents

Package Management

Package Management in Linux allows for the makers of a distribution to distribute software packages in a pre-defined manner. The benefits of using package management systems is that they install software with pre-set configurations, the creators have more control over where the package is installed, what configuration settings are the defaults, and an easier method of upgrading currently installed packages. There are a few different methods that are available under Linux, the main being RPM, which was originally developed by Redhat, and deb, which was originally developed by Debian GNU/Linux. Please note that there are more than this, however these are the most popular.

RPM

RPM's are used on many different distributions, the most popular being Redhat, Mandrake and SUSE.

Installing a package:

rpm -i ***.rpm

Upgrading a package:

rpm -Uvh ***.rpm

Erase/uninstall a package:

rpm -e package-name

Force installation of a package (ignore dependencies, etc.):

rpm -Uvh --force --nodeps ***.rpm

Query the package management database:

rpm -q package-name

Search for a package that is already installed:

rpm -qa | grep package-name

deb

Please note, there is a more extensive apt-get guide located here.

Firstly edit /etc/apt/sources.list and add your closest mirror and cds with debian on:

Example

deb ftp://ftp.us.debian.org/debian stable main contrib non-free
deb cdrom:[Debian GNU/Linux 2.2 r0 _Potato_ - Official i386 Binary-1 (20000814)]

then run apt-get update

DPKG

install - dpkg -i package.deb

remove/uninstall - dpkg -r package

List files asscoiated with package -dpkg -L package

Version - dpkg -l package

Unpack A deb - dpkg -unpack package.deb

APT

install - apt-get install <package>

search - apt-cache search <package>

remove - apt-get remove <package>

(When using apt-get to download off the Internet, the .deb files are placed in /var/cache/apt/archives)

Network Side

  • Allow Hosts -edit/etc/hosts.allow #Example Service:IP-ADDRESS
  • Deny Hosts - edit /etc/hosts.allow # Example ALL:ALL
  • Hosts on Network - edit/etc/hosts
  • Example IPADDRESS HOSTNAME HOSTNAME.DOMAINNAME
  • Set Hostname - hostname <hostname>
  • Nameservers - edit /etc/resolv.conf

Kernel Upgrade

Refer to Joey's Kernel Compile guide for full instructions

cp  linux-*.*.*.tar.gz ; tar zxvf linux-*.*.*.tar.gz ; mv linux /usr/src/linux-*.*.*

cd /usr/src/linux ; make menuconfig  (go to bottom save config to a file /usr/src/oldconfig)

rm /usr/src/linux ; ln -s /usr/src/linux-*.*.* ; cd /usr/src/linux

make menuconfig (go to bottom load up config file /usr/src/oldconfig, save and and exit)

make dep; make clean; make bzImage; make modules; make modules_install; make install ; reboot

Sound Configuration

Redhat Distribution: run sndconfig In Debian: Compile soundcard module into kernel

                       Edit /etc/modules

In Slackware: Compile module into kernel

                       Edit/etc/rc.d/rc.modules

Useful Information

  • run cat on these files - cat /proc/<filename>
  • Install nmap -nmap <Your IP> <- Will list ports open
  • Edit /etc/fstab- place in partitions and drives to be mount
  • Edit /etc/inittab- Change Runlevel (ie X or Console)
  • Edit /etc/inetd.conf- Add/Remove Services
  • Edit /etc/syslog.conf - Information on log files
  • Useful commands - free ; ps aux ; top
  • Changing Window Manager in Debian - update-alternatives x-window-manager
  • Changing Window Manager in Slackware -xwmconfig
  • Progammer? Use Vim? - Edit .vimrcadd these lines
set autoindent
syn on
set cindent

Themes

Window Maker mv wm-theme.tar.gz ~/GNUstep/Library/WindowMaker cd ~/GNUstep/Library/WindowMake tar zxvf wm-theme.tar.gz (Right click, Work space>Appearance>Themes>WM-theme)

Enlightenment mv e-theme.tar.gz /usr/share/enlightenment/themes/ || ~/.enlightenment/themes/ run e-conf

gtk mkdir ~/themes ; mkdir ~/themes/gnome/ mv gtk-theme.tar.gz gnomecc (Desktop >Theme selector)

Sawfish cp sawfish-theme.tar.gz /usr/share/sawmill || ~./sawmill/themes/