Git: Staging Area aka “index”

  • Working Tree
  • Index / Stage / Staging Area / Cache
  • Repository

The Staging Area (also called the “index”) is where Git remembers which changes are marked to be committed. If a change is not “staged” it will not be committed. A change can be as granular as a single changed line in a file, leading to very precise commits. If, after staging a change, you decide you don’t want that change to go into the next commit, you can also “unstage” it.

Stage file: $ git add
Unstage file: $ git reset HEAD

Git Basics – Undoing Things

Removing untracked files from your git working copy
$ git clean -f

git-clean
Removing untracked files from your git working copy

Ubuntu: Add new PPA (Personal Package Archive) repository

PPA = Personal Package Archives
Repository = A collection of software you can download quickly and easily.

Personal Package Archives for everyone!

Add Repository

$ sudo add-apt-repository ppa:vala-team
$ sudo add-apt-repository ppa:irie/blender   ==>   https://launchpad.net/~irie/+archive/blender
$ sudo apt-get update
$ sudo apt-get install [...]

Remove Repository

$ sudo add-apt-repository --remove ppa:vala-team

How can PPAs be removed?

Show current version of package

$ apt-cache policy blender
blender:
  Installed: 2.66a-3ubuntu2
  Candidate: 2.70+git201403201745.dfa5ced-0irie1~saucy1
  Version table:
     2.70+git201403201745.dfa5ced-0irie1~saucy1 0
        500 http://ppa.launchpad.net/irie/blender/ubuntu/ saucy/main i386 Packages
 *** 2.66a-3ubuntu2 0
        500 http://mirror.switch.ch/ftp/mirror/ubuntu/ saucy/universe i386 Packages
        100 /var/lib/dpkg/status

How to check the version before install packages using apt-get
Check package version using apt-get/aptitude?

GNOME tools: gnome-common, intltool

$ sudo apt-get install gnome-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  autopoint intltool
The following NEW packages will be installed:
  autopoint gnome-common intltool
0 upgraded, 3 newly installed, 0 to remove and 1163 not upgraded.
Need to get 673 kB of archives.
After this operation, 1,127 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

$ sudo apt-get install gtk-doc-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  docbook docbook-dsssl docbook-to-man jade libsp1c2 sp
Suggested packages:
  docbook-defguide psgml jadetex docbook-dsssl-doc
The following NEW packages will be installed:
  docbook docbook-dsssl docbook-to-man gtk-doc-tools jade libsp1c2 sp
0 upgraded, 7 newly installed, 0 to remove and 1163 not upgraded.
Need to get 2,895 kB of archives.
After this operation, 13.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

$ sudo apt-get install yelp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libyelp0
The following packages will be upgraded:
  libyelp0 yelp
2 upgraded, 0 newly installed, 0 to remove and 1161 not upgraded.
Need to get 179 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y

$ sudo apt-get install yelp-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  itstool
The following NEW packages will be installed:
  itstool yelp-tools
0 upgraded, 2 newly installed, 0 to remove and 1161 not upgraded.
Need to get 35.4 kB of archives.
After this operation, 408 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

$ sudo apt-get install gobject-introspection
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgirepository-1.0-1
The following NEW packages will be installed:
  gobject-introspection
The following packages will be upgraded:
  libgirepository-1.0-1
1 upgraded, 1 newly installed, 0 to remove and 1160 not upgraded.
Need to get 384 kB of archives.
After this operation, 1,162 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

$ sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gstreamer0.10-plugins-base gstreamer0.10-plugins-base:i386 libcroco3 libcroco3:i386 librsvg2-2 librsvg2-2:i386 librsvg2-common librsvg2-common:i386 libsoup2.4-1 libsoup2.4-1:i386 libxml2 libxml2:i386
  libxslt1.1 libxslt1.1:i386
Suggested packages:
  librsvg2-bin librsvg2-bin:i386
Recommended packages:
  xml-core:i386
The following NEW packages will be installed:
  libxml2-dev
The following packages will be upgraded:
  gstreamer0.10-plugins-base gstreamer0.10-plugins-base:i386 libcroco3 libcroco3:i386 librsvg2-2 librsvg2-2:i386 librsvg2-common librsvg2-common:i386 libsoup2.4-1 libsoup2.4-1:i386 libxml2 libxml2:i386
  libxslt1.1 libxslt1.1:i386
14 upgraded, 1 newly installed, 0 to remove and 1146 not upgraded.
Need to get 5,027 kB of archives.
After this operation, 2,888 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

WD MyBook Live: mediacrawler aus Autostart nehmen

[root@MyBookLive ~]# vi /etc/nas/service_startup/orion
Vorher: enabled
Nachher: disabled

mediacrawler:
[root@MyBookLive ~]# update-rc.d -f orion remove
 Removing any system startup links for /etc/init.d/orion ...
   /etc/rc0.d/K05orion
   /etc/rc2.d/S86orion
   /etc/rc3.d/K05orion
   /etc/rc4.d/K05orion
   /etc/rc6.d/K05orion

twonky:
[root@MyBookLive ~]# update-rc.d -f twonky remove
 Removing any system startup links for /etc/init.d/twonky ...
   /etc/rc0.d/K10twonky
   /etc/rc2.d/S85twonky
   /etc/rc3.d/K10twonky
   /etc/rc4.d/K10twonky
   /etc/rc6.d/K10twonky

itunes:
[root@MyBookLive ~]# update-rc.d -f forked-daapd remove
 Removing any system startup links for /etc/init.d/forked-daapd ...
   /etc/rc0.d/K10forked-daapd
   /etc/rc2.d/S84forked-daapd
   /etc/rc3.d/K10forked-daapd
   /etc/rc4.d/K10forked-daapd
   /etc/rc6.d/K10forked-daapd
# update-rc.d -f orion remove
Removing any system startup links for /etc/init.d/orion ...
   /etc/rc0.d/K05orion
   /etc/rc2.d/S86orion
   /etc/rc3.d/K05orion
   /etc/rc4.d/K05orion
   /etc/rc6.d/K05orion

# /etc/init.d/orion stop

# update-rc.d orion defaults; /etc/init.d/orion start

Ubuntu: install build dependencies

$ sudo apt-get build-dep wireshark-dev
[sudo] password for andreas: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking 'wireshark' as source package instead of 'wireshark-dev'
Note, selecting 'libcap-dev' instead of 'libcap2-dev'
The following NEW packages will be installed:
  comerr-dev debhelper dh-apparmor geoip-bin html2text krb5-multidev libasound2-dev libatk1.0-dev libc-ares-dev libcairo-script-interpreter2 libcairo2-dev libcap-dev libdbus-1-dev libexpat1-dev
  libfontconfig1-dev libfreetype6-dev libgcrypt11-dev libgdk-pixbuf2.0-dev libgeoip-dev libglib2.0-dev libgnutls-dev libgnutls-openssl27 libgnutlsxx27 libgpg-error-dev libgssrpc4 libgtk2.0-dev
  libjack-jackd2-dev libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 libkrb5-dev liblua5.1-0-dev libp11-kit-dev libpango1.0-dev libpcap0.8-dev libpcre3-dev libpcrecpp0 libpixman-1-dev libpng12-dev
  libportaudiocpp0 libreadline-dev libreadline6-dev libsmi2-dev libtasn1-3-dev libxcb-render0-dev libxcb-shm0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxft-dev libxi-dev
  libxinerama-dev libxrandr-dev libxrender-dev po-debconf portaudio19-dev python-ply x11proto-composite-dev x11proto-damage-dev x11proto-fixes-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
  x11proto-xinerama-dev xsltproc
The following packages will be upgraded:
  bluez-alsa bluez-alsa:i386 gir1.2-atk-1.0 gir1.2-gdkpixbuf-2.0 glib-networking glib-networking:i386 glib-networking-common glib-networking-services gstreamer0.10-plugins-good gstreamer0.10-plugins-good:i386
  gtk2-engines-pixbuf:i386 libasound2 libasound2:i386 libatk1.0-0 libatk1.0-0:i386 libatk1.0-data libcairo-gobject2 libcairo-gobject2:i386 libcairo2 libcairo2:i386 libcanberra-pulse libcanberra0
  libcanberra0:i386 libcap2 libcap2:i386 libdbus-1-3 libdbus-1-3:i386 libexpat1 libexpat1:i386 libfreetype6 libfreetype6:i386 libgail-common libgail-common:i386 libgail18 libgail18:i386 libgdk-pixbuf2.0-0
  libgdk-pixbuf2.0-0:i386 libgdk-pixbuf2.0-common libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa libglapi-mesa:i386 libglib2.0-0 libglib2.0-0:i386 libglib2.0-bin libgnutls26 libgnutls26:i386 libgpg-error0
  libgpg-error0:i386 libgtk2.0-0 libgtk2.0-0:i386 libjack-jackd2-0 libjack-jackd2-0:i386 libpcre3 libpcre3:i386 libportaudio2 libreadline6 libvisual-0.4-plugins libvisual-0.4-plugins:i386 libxcb-render0
  libxcb-render0:i386 libxcb-shm0 libxcb-shm0:i386 libxcomposite1 libxcomposite1:i386 libxcursor1 libxcursor1:i386 libxdamage1 libxdamage1:i386 libxext6 libxext6:i386 libxfixes3 libxfixes3:i386 libxi6
  libxi6:i386 libxinerama1 libxinerama1:i386 libxrandr2 libxrandr2:i386 libxrender1 libxrender1:i386
81 upgraded, 67 newly installed, 0 to remove and 1161 not upgraded.
Need to get 34.3 MB of archives.
After this operation, 62.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

Inject packets from PCAP-format

tcpreplay / tcprewrite

$ sudo apt-get install tcpreplay
$ tcpreplay -t -L <limit> -i <interface> <file.cap>

Options:
-i string, --intf1=string      Server/primary traffic output interface.
-I string, --intf2=string      Client/secondary traffic output interface.
-L number, --limit=number      Limit the number of packets to send.

-M float , --mbps=float        Replay packets at a given Mbps. Specify a floating point value.
-t,        --topspeed          Replay packets as fast as possible. 
-p number, --pps=number        Replay packets at a given packets/sec.
without -t or -p               Send out packets as in the timestamp of each packet of the PCAP file.

tcpreplay.synfin.net Wiki: tcpreplay
tcpreplay.synfin.net Wiki: tcprewrite
How to capture and replay network traffic on Linux

ostinato

packeth

$ sudo apt-get install packeth
$ sudo packeth
Load -> PCAP

netdude

Netdude 0.5.1 and libnetdude 0.12 released
Edit PCAP files in a GUI.
Netdude Homepage
Netdude Source

mergecap

Merges two or more capture files into one

mergecap [ -a ] [ -v ] -w <outfile> <infile> [<infile> ...]
-a             Causes the frame timestamps to be ignored. 
               When -a is not specified, the contents of the input files are merged
               in chronological order based on each frame's timestamp.
-v             Causes mergecap to print a number of messages while it's working.
-w  <outfile>  Sets the output filename.

capinfos

Prints information about capture files

-a    Displays the start time of the capture.
-e    Displays the end time of the capture.
-c    Displays the number of packets in the capture file.
-u    Displays the capture duration, in seconds.
-S    Display the start and end times as seconds (unixtime)

editcap

Edit and/or translate the format of capture files

-A  <start time>               Saves only the packets whose timestamp is on or after start time. 
-B  <stop time>                Saves only the packets whose timestamp is before stop time.
-t  <time adjustment>          Sets the time adjustment to use on selected packets.
                               The adjustment is specified as [-]seconds[.fractional seconds].
-S  <strict time adjustment>   Time adjust selected packets to insure strict chronological order.
                               The value represents relative seconds specified as [-]seconds[.fractional seconds].
                               If the value is 0 or greater then only packets with a timestamp less than the previous packet will be adjusted.
                               If the value is specified as a negative value, then the timestamp values of all packets will be adjusted
                               to be equal to the timestamp value of the previous packet plus the absolute value of the value