Unix-Cribsheet

General

Disk by uuid

Attached disks by uuid in directory: /dev/disk/by-uuid

netmask syntax

IPv4 numbers are 32 bit, represented as:
8bit.8bit.8bit.8bit
The netmask is AND'ed with the packet ip. For example 255.255.255.0 is really 11111111 . 11111111 . 11111111 . 00000000 making the last 8 bits (byte) zero'd out - effectively a wildcard.
/xx syntax masks out this many bits. So /8 would be 255.0.0.0, /16 would be 255.255.0.0, /24 is 255.255.255.0 etc.

xhost

Default configuration for X server is to ignore TCP requests. Won't be able to setenv DISPLAY <remotehost> Re-enable in /etc/gdm.conf: DisallowTCP=false

sed

sed -e <expression>
Useful tcsh script to convert graphic file formats (assumes imagemagick installed):

tcsh> foreach i (*.bmp)
foreach? convert $i `sed -e s/bmp/png/`
foreach? end

rsync

When using in windows: rsync -rvTL

GRUB

See grub-cribsheet. Included here:

Tiger

Tiger security output explanation use: tigexp <output code>

gdb

Chmod permissions

Apache

  • enable mods with a2enmod, for example to startup php:
    • a2enmod php5

Postfix

Video for Linux (v4l)

NFS

fsck

dd

tar

  • Useful flags: -C, —directory=DIR : change to directory DIR
  • Example: tar cf - . | tar —directory=/targetdir -xvf -

Backup database

Set timezone

tzconfig

ps

  • Process table queries for ps: -p pid, —user <username> -l long format -f full listing -w wide format
    • ps -p <pid> eww

Netstat

  • useful flags: -v verbose, —numeric-ports, -c continuous update, -p program and process ids, —inet inet protocol
    • netstat -vpn —inet

grep

  • Useful flags: -v, —invert-match : invert match sense

Iptables

samba

nmap

Fedora

Ubuntu

Services

  • Howto Bootup
    • Make the init.d script not-executable… you'll get an error in startup, but it won't run.
  • More clean way with config

Runlevels

  • sysv-rc-conf

Package management

aptitude

dpkg

apt-get

Configure X

Alacarte

  • Configure GNOME menus using Alacarte by pressing Alt+F2 and typing alacarte

locale

To see the list of valid locales, enter the following command:

locale -a

Listing hardware

  • lshw -C disk List disk hardware devices
  • lshw -short
  • lsusb
  • lspci

Compiz

Manually launch Compiz Configuration Settings Manager using ccsm. Useful if window manager is broken, and you can only get an xterm in failsafe mode.

Compiz services can be selectively turned off by deleting their entry in ~/.config/compiz/compizconfig/Default.ini

Also, debug the directory ~/.gconf/apps/compiz especially general/allscreens.
In one particular case, I broke compiz by enabling Accessiblity/Magnifier
Edit ~/.gconf/apps/compiz/general/allscreens/options/%gconf and remove the entry for mag.

GNOME

If window manager is broken, consider purging/renaming ~/.gconf directory. If that fixes it, see if you can find the offending configuration setting.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License