Tag Archives: ubuntu

Mount disk image partition

View partition table of disk.img:

fdisk -lu disk.img
Disk disk.img: 1.3 GiB, 1361051648 bytes, 2658304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6f92008e

Device    Boot  Start     End Sectors  Size Id Type
disk.img1        8192  131071  122880   60M  c W95 FAT32 (LBA)
disk.img2      131072 2658303 2527232  1.2G 83 Linux

Mount partition by using start multiplied by sector size as offset

mount -o loop,offset=$((131072 * 512)) disk.img /mnt

Tmux on login

to start tmux on login add the following to your ~/.bashrc

# Start Tmux by default
# If not running interactively, do not do anything
if command -v tmux>/dev/null; then
  [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
fi

Auto attach

to automatically attach to last session or create a new if none available extend your ~/.bashrc and ~/.tmux.conf with the following

~/.bashrc

# Start Tmux by default
# If not running interactively, do not do anything
if command -v tmux>/dev/null; then
  [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux attach
fi

~/.tmux.conf

# if run as "tmux attach", create a session if one does not already exist
new-session -n $HOST

Continue reading Tmux on login

install script

For Ubuntu/Debian

#!/bin/bash

#tools
PACKAGES=" pdftk "                              # pdf console tools like pdf merging
PACKAGES="$PACKAGES wine"
PACKAGES="$PACKAGES gnuplot"
PACKAGES="$PACKAGES qalculate-gtk"              # advanced simple calculator app
PACKAGES="$PACKAGES pdf-presenter-console"      # console tool for presentations with pdf files
PACKAGES="$PACKAGES stellarium"                 # planetarium software
PACKAGES="$PACKAGES kalzium"                    # kalzium is a PSE software
PACKAGES="$PACKAGES gthumb"                     # gthumb is a picture viewer
PACKAGES="$PACKAGES htop"                       # htop is a more sophisticated version of top
PACKAGES="$PACKAGES basket"                     # note application
PACKAGES="$PACKAGES vpnc"                       # console based VPNC client

# media tools
PACKAGES="$PACKAGES gimp"                       # image editor
PACKAGES="$PACKAGES inkscape"                   # image editor for fast creating vector graphics

PACKAGES="$PACKAGES audacity"                   # audio editor
PACKAGES="$PACKAGES acroread"                   # adobe acrobat reader
PACKAGES="$PACKAGES skype"
PACKAGES="$PACKAGES vlc"                        # vlc media player

# network tools
PACKAGES="$PACKAGES filezilla"                  # tool for ftp/sftp transfers

PACKAGES="$PACKAGES gs gv"                      # ghostscript / view (? to check)
PAKCAGES="$PACKAGES rar"

# network essentials
PACKAGES="$PACKAGES pidgin pidgin-otr thunderbird firefox"
# editors
PACKAGES="$PACKAGES gedit"                      # multi purpose GUI editor
PACKAGES="$PACKAGES texstudio"                  # for latex
PACKAGES="$PACKAGES vim"                        # vi console based editor with several extensions

# java stuff
PACKAGES="$PACKAGES eclipse"                    # IDE will also install current java version

# c++ stuff
PACKAGES="$PACKAGES build-essential gcc"
PACKAGES="$PACKAGES gdb"                        # debugger
PACKAGES="$PACKAGES codeblocks"                 # IDE

# doxygen for documentation of c++ projects (note don't know why graphviz appears here)
PACKAGES="$PACKAGES doxygen doxygen-doc doxygen-gui graphviz doxygen-latex"

# SDL for Games and also DEV for graphic programming
PACKAGES="$PACKAGES libsdl-gfx1.2-4 libsdl-gfx1.2-dev libsdl1.2-dev libsdl1.2debian"

# the boost library dev package -> large c++ libary
PACKAGES="$PACKAGES libboost-all-dev"

# qt packages
PACKAGES="$PACKAGES libqt4-core libqt4-dev qt4-dev-tools qt4-designer qt4-doc"

# games
PACKAGES="$PACKAGES sauerbraten libopenal1 openarena"

# latex
PACKAGES="$PACKAGES texlive-latex3 texlive-science texlive-extra"

# python
PACKAGES="$PACKAGES python"
PACKAGES="$PACKAGES python-pip"                 # command line tool for installing python packages

# scipy packages
PACKAGES="$PACKAGES python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose"

# if the user is not root finish
if [ "$(whoami)" != "root" ];
then
    echo "you must be root!"
    echo "please restart as root"
    exit
fi

# update && upgrade before installing packages
apt-get update
apt-get upgrade -y

#Installing all Ubuntu deb packages
for P in $PACKAGES; do
    echo Installing $P
    apt-get install $P -y
    echo $P ready
done

For arch

#!/bin/bash

###tools
## Pacman
pacmanpacs="wine"                               # WINE Is Not an Emulator
pacmanpacs="$pacmanpacs gnuplot"
pacmanpacs="$pacmanpacs qalculate-gtk"          # advanced simple calculator app
pacmanpacs="$pacmanpacs stellarium"             # planetarium software
pacmanpacs="$pacmanpacs kdeedu-kalzium"         # kalzium is a PSE software
pacmanpacs="$pacmanpacs gthumb"                 # gthumb is a picture viewer
pacmanpacs="$pacmanpacs htop"                   # htop is a more sophisticated version of top
pacmanpacs="$pacmanpacs basket"                 # note application
pacmanpacs="$pacmanpacs openconnect vpnc"       # console based VPN clients (Cisco compatible)
pacmanpacs="$pacmanpacs openssh sshfs"          # SSH tools
pacmanpacs="$pacmanpacs gv"                     # gostscript / view (? to check)
pacmanpacs="$pacmanpacs unrar"

## Yaourt
yaourtpacs=" pdftk"                             # pdf console tools like pdf merging
yaourtpacs="$yaourtpacs pdf_presenter_console"  # console tool for presentations with pdf files

### media tools
## Pacman
pacmanpacs="$pacmanpacs inkscape"               # image editor for fast creating vector graphics
pacmanpacs="$pacmanpacs audacity"               # audio editor
pacmanpacs="$pacmanpacs skype"
pacmanpacs="$pacmanpacs smplayer vlc xbmc"      # media player

## Yaourt
yaourtpacs="$yaourtpacs acroread"               # adobe acrobat reader

### network tools
## Pacman
pacmanpacs="$pacmanpacs filezilla"              # tool for ftp/sftp transfers
pacmanpacs="$pacmanpacs pidgin pidgin-otr"      # Pidgin
pacmanpacs="$pacmanpacs thunderbird firefox"    # Mozilla things

## Yaourt
yaourtpacs="$yaourtpacs dropbox"                # Cloud Tool

### editors
## Pacman
pacmanpacs="$pacmanpacs vim"                    # vi console based editor with several extensions

## Yaourt
yaourtpacs="$yaourtpacs texstudio"              # for latex

### java stuff
## Pacman
pacmanpacs="$pacmanpacs subversion eclipse"     # IDE will also install current java version
pacremove="jdk7-openjdk"                        # Will be removed

## Yaourt
yaourtpacs="$yaourtpacs jdk7"                   # Oracle JDK

### c++ stuff
## Pacman
pacmanpacs="$pacmanpacs gdb"                    # debugger
pacmanpacs="$pacmanpacs eclipse-cdt codeblocks" # IDE
pacmanpacs="$pacmanpacs doxygen doxygen-docs graphviz"    # doxygen for documentation of c++ projects (note don't know why graphviz appears here)
pacmanpacs="$pacmanpacs sdl sdl_gfx sdl_image " # SDL for Games and also DEV for graphic programming
pacmanpacs="$pacmanpacs sdl_mixer sdl_net sdl_ttf smpeg"
pacmanpacs="$pacmanpacs sdl2 sdl2_gfx sdl2_image"
pacmanpacs="$pacmanpacs sdl2_mixer sdl2_net sdl2_ttf smpeg2"
pacmanpacs="$pacmanpacs boost boost-libs"       # the boost library dev package ->; large c++ libary
pacmanpacs="$pacmanpacs qt qtcreator"           # qt packages

### games
## Pacman
pacmanpacs="$pacmanpacs sauerbraten 0ad"

## Yaourt
yaourtpacs="$yaourtpacs openarena 7kaa"

### latex
## Pacman
pacmanpacs="$pacmanpacs texlive-most"

### python
## Pacman
pacmanpacs="$pacmanpacs python-pip"             # command line tool for installing python packages
pacmanpacs="$pacmanpacs python-scipy python-matplotlib"   # scipy packages
pacmanpacs="$pacmanpacs python-sympy python-nose"

## Yaourt
yaourtpacs="$yaourtpacs python-pandas"

# if the user is not root finish
if [ "$(whoami)" != "root" ];
then
    echo "you must be root!"
    echo "please restart as root"
    exit
fi

# update and upgrade the system
pacman -Syu --noconfirm

# remove unneeded packages
pacman -Rcdd $pacremove --noconfirm

# add AUR packages
yaourt -S $yaourtpacs --noconfirm

# add normal packages
pacman -S $pacmanpacs --noconfirm