# Debian Reference Card

The 101 most important things when using Debian

## Getting Help

man `page` or man bash

Read online help for every command and many configuration files.

`command` `--`help, `-`h

Brief help for most commands.

`/usr/share/doc/`package-name`/`

Find all documentation here, optional file `README.Debian` contains specifics.

Web documentation

Reference, manuals, FAQs, HOWTOs, etc. at `https://www.debian.org/doc/`

Mailing lists at `https://lists.debian.org/`

The community is always helpful, search for `users`.

The Wiki at `https://wiki.debian.org/`

Contains all kind of useful information.

## Installation

Installer

All information about it at `https://www.debian.org/devel/debian-installer/`

CD images

Download from `https://www.debian.org/distrib/`

`boot: expert`

E.g. to set up the network w/o DHCP or using LILO instead of GRUB.

## Bugs

Bug Tracking at `https://bugs.debian.org/`

All about existing and fixed bugs.

Package specific

See `https://bugs.debian.org/`package-name`/`, use `wnpp` to ask for new packages.

reportbug

Report a bug by e-mail.

Reporting

Instructions at `https://www.debian.org/Bugs/Reporting`

## Configuration

`/etc/`

All system configuration files are under directory `/etc/`.

editor `files`

Default text editor. May be `nano`, `emacs`, `vi`, `joe`.

CUPS at `http://hostname:631`

Browser interface to printing system.

dpkg-reconfigure `package-name`

Reconfigure a package, e.g. `keyboard-configuration` (keyboard), `locales` (localization).

update-alternatives `options`

Manage command alternatives.

update-grub

After changing `/etc/default/grub`.

## Daemons and System

`systemctl restart `name`.service`

Restart a service, system daemon.

`systemctl stop `name`.service`

Stop a service, system daemon.

`systemctl start `name`.service`

Start a service, system daemon.

systemctl halt

Halts system.

systemctl reboot

Reboots system.

systemctl poweroff

Shuts down system.

systemctl suspend

Suspends system.

systemctl hibernate

Hibernates system.

`/var/log/`

All log files are under this directory.

`/etc/default/`

Default values for many daemons and services.

## Important Shell Commands

cat `files`

Print files to screen.

cd `directory`

Change to directory.

cp `files` `dest`

Copy files and directories.

echo `string`

Echo string to screen.

gzip, bzip2, xz `-d` `files`

Compress, uncompress files.

pager `files`

Show contents of files.

ls `files`

List files.

mkdir `directory-names`

Create directories.

mv `file1` `file2`

Move, rename files.

rm `files`

Remove files.

rmdir `dirs`

Remove empty directories.

tar c x t z j J -f `file`.tar `files`

Create (c), extract (x), list table of (t) archive file, z for `.gz`, j for `.bz2`, J for `.xz`.

find `directories expressions`

Find files like `-name `name`` or `-size `+1000``, etc.

grep `search-string` `files`

Find search-string in files.

ln -s `file` `link`

Create a symbolic link to a file.

ps `options`

Show current processes.

kill `-9` `PID`

Send signal to process (e.g. terminate it). Use `ps` for PID.

su - `username`

Become another user, e.g. `root`.

sudo `command`

Execute a command as `root` as normal user, see `/etc/sudoers`.

`command` `>` `file`

Overwrite file with output of command.

`command` `>>` `file`

Append output of command to file.

`cmd1` `|` `cmd2`

Use output of command 1 as input of command 2.

`command` `<` `file`

Use file as input for command.

## APT

apt update

Update packages listings from package repositories as listed in `/etc/apt/sources.list`. Required whenever that file or the contents of the repositories change.

apt search `search-string`

Search packages and descriptions for `search-string`.

apt list -a `package-name`

Show versions and archive areas of available packages.

apt show -a `package-name`

Show package information incl. description.

apt install `package-names`

Install packages from repositories with all dependencies.

apt upgrade

Install newest versions of all packages currently installed.

apt full-upgrade

Like `apt upgrade`, but with advanced conflict resolution.

apt remove `package-names`

Remove packages.

apt autoremove

Remove packages that no other packages depend on.

apt depends `package-name`

List all packages needed by the one given.

apt rdepends `package-name`

List all packages that need the one given.

apt-file update

Update content listings from package repositories, see `apt update`.

apt-file search `file-name`

Search packages for file.

apt-file list `package-name`

List contents of a package.

aptitude

Console interface to APT, needs `aptitude`.

synaptic

GUI interface to APT, needs `synaptic`.

## Dpkg

dpkg -l `names`

List packages.

dpkg -I `pkg`.deb

Show package information.

dpkg -c `pkg`.deb

List contents of package file.

dpkg -S `filename`

Show which package a file belongs to.

dpkg -i `pkg`.deb

Install package files.

dpkg -V `package-names`

Audit check sums of installed packages.

dpkg-divert options `file`

Override a package's version of a file.

dpkg `--compare-versions` `v1` gt `v2`

Compare version numbers; view results with `echo $?`.

dpkg-query -W `--showformat`=`format`

Query installed packages, format e.g. '${Package} ${Version} ${Installed-Size}\n'.

dpkg `--get-selections` > `file`

Write package selections to file.

dpkg `--set-selections` < `file`

Set package selections from file.

## The Network

`/etc/network/interfaces`

Interface configuration (if not controlled via network-manager).

ip link set `device` up down

Start, stop network interfaces according to the file above.

ip

Show and manipulate network interfaces and routing, needs `iproute2`.

ssh -X `user@host`

Login at another machine.

scp `files` `user@host:path`

Copy files to other machine (and vice versa).