Cheat Sheets

Debian/Ubuntu cheat sheet

Find packages that contain a file

apt-file search "somefile"

List all installed packages

% apt-cache pkgnames
% dpkg -l

List files owned by package

% dpkg -L pkg

What package owns a file

% dpkg -S /path/to/file

Display package information

% dpkg -p pkg

Fedora cheat sheet

Disable SELinux

/usr/sbin/setenforce 0

VIM cheat sheet

Command Effect
:opt Options window, display current vim configuration

Microsoft Windows cheat sheet

Installation

Selecting different HAL during installation

A different HAL (e.g. Standard HAL instead of ACPI HAL) can be chosen on installation by hitting F5 during the Press F6 if you need to install a third party SCSI or RAID driver message.

Commands

Recursive directory removal

rmdir /s /q [directory]

Removing desktop.ini files from a directory structure

FOR /f %G in ('dir /b') do attrib %G\desktop.ini -h -s
FOR /f %G in ('dir /b') do del %G\desktop.ini

IPv4 CIDR notation cheat sheet

IPv4 network addressing cheat sheet, with CIDR notation, number of addresses, and masks.

MySQL cheat sheet

Backup and restore

Backing up tables:

mysqldump -p -c -Q databasename tablename1 tablename2 ... > whatever.sql

Restoring tables:

mysql -p databasename < whatever.sql

Creating a user and their own database

CREATE DATABASE dbname;
GRANT USAGE ON dbname.* TO username@'%';
GRANT ALL ON dbname.* TO username@'%';
SET PASSWORD FOR username@'%' = PASSWORD('blah');
FLUSH PRIVILEGES;

Changing passwords

SET PASSWORD = PASSWORD('blah');

Changing administrator password

mysql -u root
mysql> SET PASSWORD FOR root@localhost = PASSWORD('new_password');

Disabling network access

In my.cnf, add the keyword ==skip-networking== and the line ==bind-address=127.0.0.1== (for any applications that still require TCP networking) to the ==![mysqld]== section.

Flushing Initial Database and Users

drop database test;
use mysql;
delete from db;
delete from user where not (host="localhost" and user="root");
flush privileges;

Deleting users

REVOKE ALL PRIVILEGES ON . FROM username@'%'; REVOKE GRANT OPTION ON . FROM username@'%';

Syndicate content