Linux Cheat Sheet

diggFurldel.icio.usFacebook

System

Filesystem

Change the mode of all files to 666 (—rw-rw-rw) recursively from the current directory

find . -type f -exec chmod 666 {} \;

Change the mode of all directories to 777 (—rwxrwxrwx) recursively from the current directory

find . -type f -exec chmod 777 {} \;

CDROMs, DVDs and ISOs

Make an .ISO image file on-disk from a cdrom

dd if=/dev/cdrom of=cdrom.iso

Mount an ISO image

mount -o loop cdrom.iso /mnt/iso

Process Management

Find a process by name

ps -ef | grep <process name>

Kill a process by name

killall <process name>

Stop (pause) a process

kill -SIGSTOP <pid>

Stop (pause) a process and all it's children processes

kill -SIGSTOP -<pid>

To continue a stopped (paused) process use the SIGCONT signal instead.

Shell (Bash)

Spawn a process as a background job

$> <executable> &

List all jobs in the shell

$> jobs

Disown a spawned job (so it isn't killed when the shell exits)

$> disown %<job number>

Networking

Discovery

Ping broadcast

ping -b 192.168.1.255

DNS domain transfer

host -l <domain>

Ports

Find all opened ports and by whom

netstat -tulpn

Dump the arp entries

arp -a

Find open ports on a remote computer

nmap -v <IP or hostname>

Remote Desktops

Start a desktop session that can be accessed remotely

vncserver

Connect to the remote desktop session from your local computer

vncviewer <hostname or ip>:1

Initiate a reverse desktop connection (usually used to bypass firewalls)
from the client box

vncserver -listen <port>

from the system that owns the desktop

vncconfig -display :1 -connect <hostname or ip>:<port>

Edit ~/.vnc/xstartup to modify which desktop and applications auto start on your desktop

Start a desktop from within a desktop

xinit ~/.xinitrc -- `which Xnest` :5

where ~/.xinitrc contains:

#!/bin/bash
exec /usr/kde/3.5/bin/startkde

(or to your preferred window manager)

Applications

Firefox

Set the VM (Gentoo Specific)
in a browser tab type 'about:config'
Set the value java.default_java_location_others to /etc/java-config-2/current-system-vm

Java

List all VMs

java-config -L

Set the default VM

java-config -S <VM name>

VIM

Replace all occurances of string1 to string2 in a file

%s/string1/string2/g

Oracle Server 10g

General

Start the database

dbstart

Stop the database

dbstop

Start the TNS listener

tnslsnrctl start

Stop the TNS listener

tnslsnrctl stop

Get the status of the TNS listener

tnslsnrctl status

SQLPLUS

Login using a fully qualified specification

sqlplus <user>/<password>@<host>/<SID>

DataPump

Export a schema to a file

expdp <user>/<password> schemas=<schema name> directory=my_dumps logfile=dump.log dumpfile=dumpfile.dmp

Import a a dump file

impdp <user>/<password> schemas=<schema name> directory=my_dumps logfile=dump_import.log dumpfile=<dump filename>

Import a dumpfile while remapping it to another schema

impdp <user>/<password> schemas=<schema name> remap_schema=<schema name>:<new schema name> directory=my_dumps logfile=dump_import.log dumpfile=<dump filename>

Retrieve the number of clients connected to an Oracle server

sqlplus> select count(*) from v$sessions;

Enterprise Manager

Start/Stop/Status the Enterprise Manager

emctl start|stop|start dbconsole

Browser URL

[http://www.example.com http://<host>:1158/em]

Comments

Add your comment

Add a new comment
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License