Interactive Programs

Emacs

Indent everythingM-x indent-region
Forward searchC-s
Backward searchC-r
Repeat old searchesC-s M-pC-s M-n
Regexp searchC-M-s
Search word under the cursor (beginning at the cursor position)C-s C-w
Show only lines which match your regular expressionM-x occur RET fooM-x list-matching-lines RET foo
Removes lines which matches regular expressionsM-x flush-lines
Removes lines which does not match regular expressionM-x keep-lines
Counts the number of occurrences for the given expressionM-x count-matches RET foo
Execute grep and get outputM-x grep RET grep -e root /etc/passwd
Search and replaceM-%
Set markC-SPACE
Mark paragraphM-h
Mark whole bufferC-x h
Cut regionC-w
Copy regionESC-w
Insert regionC-y
Split WindowC-x 2
Split Window side by sideC-x 3
Jump to an other part of the windowC-x o
Unsplit WindowC-x 1
New WindowC-x 5 2
Close WindowC-x 5 0
Close BufferC-x k RET
Switch to another bufferC-x b RET
Insert a spoiler (^L):C-q C-l
Macro StartC-x (
Macro StopC-x )
Macro ExecuteC-x e
Edit last macroC-x C-k
Replaces newlinesM-q
Make current word upper caseM-u
Make current word lower caseM-l
Compare two files, buffers or directoriesM-x ediffM-x ediff-buffersM-x ediff-directories
Emacs file managerM-x dired
The last 4 Words before the current cursor position are automatically inserted whenever you type fooC-u 4 C-x a + RET fooM-x list-abbrevsM-x edit-abbrevsM-x write-abbrev-file RET ~/.abbrev_defsM-x abbrev-mode

Example init.el

Search and Replace and line breaks

You can use this

C-q C-j

to insert a line break with search and replace.

Select Columns, Copy and Past columns

In emacs you can not only select rows for copy and paste but also columns. In order to achieve this, just move the cursor to the top left position of your column (in this example we assume it should start at the letter A). Now select CTRL-SPACE to start the selection.

xx Ax xx
xx xx xx
xx xB xx
xx xx xx

Afterwards, move the cursor to the lower right corner of your column. (We assume this will be at the letter B). Now you can issue

M-x kill-rectangle

The column disapears

xx xx
xx xx
xx xx
xx xx xx

You can insert it again with the command

M-x yank-rectangle

Open remote files and directories

C-x C-f RET /username@ftp.example.com:/foo/bar.txt RET

Change to passive mode

M-x customize-option RET ange-ftp-try-passive-mode RET

First row in file helps emacs to load mode

There are some special lines you can add as the first row of a file to trigger a mode in emacs SQL

-- For the benefit of emacs users -*- mode: sql; sql-product: oracle; -*-
-- For the benefit of emacs users -*- mode: sql; sql-product: ansi; -*-

Highlight parenthesis

Show where the current parenthesis opens and closes

M-x show-paren-mode

Show column of cursor

Show the cursor position in current row

M-x column-number-mode

Emacs Links

VI

Command Line

Restore filesvi -r

Modes

Command modeESC
Insert modei
Append after cursor modea
Append after linebreak modeA
Replace one characterr
Replace modeR

Files

Open file:e
Reload file:e!
Open file, jump to the end of the file:e +
Open file, jump to line z:e +z
Show filename + linenumber:f
Next file:n
Save file:w (:w!)
Quit:q (:q!)
Save + Quit:wq (ZZ)

Navigation

Move one position to the left, right, up, downh l k j
Move one page nach upCTRL f
Move one page downCTRL b
Move to the beginning of the file0
Move to the end of the file$
Move to line z:z NR
Move to the beginning of the line^
Move to the end of the line$

Edit

Delete everything from here to the end of the lineD
Delete this linedd
Delete this characterx (dl)
Copy this liney
Copy the next n linesnyy
Paste after this linep
Paste before this lineP
Undou
Undo this lineU

Search, Replace

Search/
Search backwards?
Continue searchn
Continue search but backwardsN
Replace the next alt with neu:s/alt/neu/
Replace in this line all alt with neu:s/alt/neu/g
Replace from line anfang till line ende in each line the first alt with neu(use $ for the last line):[anfang,ende]s/alt/neu/
Example::3,5s/Fogel/Vogel/

General

Show user settings:set
Show all settings:set all
Repeat command.

screen

Start a program with screenscreen prg
Send the program to the backgroundC-a C-d
Restore the programscreen -r PID

blender

Object scale (x,y,z direction)s, s x, s y, s z
Object rotate (x,y,z direction)r, r x, r y, r z
Object move (x,y,z direction)g, g x, g y, g z
Edit / objekt ModeTAB
Duplicate objektSHIFT d
Join objektsCTRL J

Stow

mkdir /usr/local/stow/paket
cd /usr/local/src/
tar xzf quelle.tgz
cd quellpaket
./configure
make
make install prefix=/usr/local/stow/paket
cd /usr/local/stow
stow -n paket
stow paket

Subversion (svn)

Revision / version control Subversion

Bochs

Bochs Manual

* bximage
  • .bochsrc
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000
megs: 256
vgaromimage: /usr/share/vgabios/vgabios.bin
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
# bximage -> X
ata0-master: type=disk, path="c.img", mode=flat, cylinders=X, heads=X, spt=X
#boot: disk
boot: cdrom
ips: 5000000
#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=/dev/stdout, dmatimer=600000
ne2k: ioaddr=0x240, irq=9, mac=12:34:56:78:90:01, ethmod=linux, ethdev=eth0
usb1: enabled=1, ioaddr=0xFF80, irq=10

GNU Plot

GNU Plot Links

GNUPLOT GNUPLOT - A Brief Manual and Tutorial

Function -> Diagram

gnuplot> plot [-pi:pi] sin(x), cos(x)
gnuplot> splot sin(x*y/20)
gnuplot> plot x**2
gnuplot> set out "/tmp/my_output.ps"
gnuplot> set terminal postscript portrait enhanced color

Data -> Diagram

gnuplot> plot "myfile.dat" using 1:2 title "2*x" with lines, "myfile.dat" using 1:3 title "x*x" with lines
myfile.dat:
0 0 1
1 2 2
2 4 4
3 6 8
4 8 16
5 10 32

Time / Date Axis

gnuplot> set xdata time
gnuplot> set timefmt "%Y%j"
gnuplot> set format x "%Y_%m"

Even More GNU Plot Commands

set boxwidth 0.1
set yrange [0:60]
set yrange [0:*]
set xrange [-1.5:1.5]

set xlabel "Foo"

set format y '%g MB/s'

set xtics ('foo' 1, '2 bar' 2)
set mytics 2

set grid
set style fill pattern border

plot "myfile.dat" using 1:2 title "foo" with boxes, "gp" using 1:3 title "bar" with boxes

set terminal png size 800 600
set output "/tmp/my_output.png"

replot

cdrdao

toc Datei

Audio-Tracks

Without leading break
TRACK AUDIO
NO COPY
FILE "01.wav" 00:00:00
With a 10 second leading break
TRACK AUDIO
NO COPY
SILENCE 00:10:00
START
FILE "01.wav" 00:00:00
Only the part from 3 minutes 5 seconds to 3 minutes 35 seconds
TRACK AUDIO
NO COPY
FILE "01.wav" 03:05:00 00:30:00
Part from 1 minute to 1 minute 30 seconds from file 01.wav and from file 02.wav everything from 2 minutes. After 1 minute and 30 seconds the index is increased
TRACK AUDIO
FILE "01.wav" 01:00:00 00:30:00
SILENCE 00:02:00
FILE "02.wav" 02:00:00
INDEX 01:30:00

Take all wav files beneath the current folder and create a toc file for an audio CD without breaks

{
echo CD_DA;
find . -name "*.wav" | while read line;
do
echo "TRACK AUDIO";
echo "NO COPY";
echo "FILE "$line" 00:00:00";
echo;
done
} > myaudiocd.toc

Ethereal

Filter

ethereal filter

(not tcp.port eq 22 and ip.addr eq 10.0.0.3 )
!(ip.addr eq 10.0.0.3)