User:Ax/Befehle

From beggabaur
< User:Ax
Revision as of 19:02, 4 March 2020 by Ax (talk | contribs)
Jump to navigation Jump to search

ALSA

~/.asoundrc | /etc/asound.conf

## Set PCH,0 the default device
defaults.ctl.!card PCH
defaults.pcm.!card PCH
#defaults.pcm.!device 0
#defaults.timer.!card PCH
#defaults.timer.!device 0
#defaults.ctl.!device 0
## (aplay -L | grep CARD)


## alsaequal plugin. See https://github.com/raedwulf/alsaequal
ctl.equal {
  type equal;
}
#
pcm.plugequal {
  type equal;
  # Modify the line below if you don't
  # want to use sound card 0.
#  slave.pcm "plughw:0,0";
  # or if you want to use with multiple applications output to dmix
  slave.pcm "plug:dmix"
}
#
pcm.equal {
  # Or if you want the equalizer to be your
  # default soundcard uncomment the following
  # line and comment the above line.
#pcm.!default {
  type plug;
  slave.pcm plugequal;
}

## ameter
## http://laugeo.free.fr/ameter.html
## Bsp.: mplayer -ao alsa:device=ameter
#pcm_scope.ameter {
#  type ameter
#}
#pcm_scope_type.ameter {
#  lib /usr/local/lib/libameter.so
#}
#pcm.ameter {
#  type meter
#  slave.pcm 'hw:0,0' #can be hw or hw:0,1 etc...
#  scopes.0 ameter
#}
#pcm.dsp0 ameter
## Some notes:
#<debianuser> [...] recently someone mentioned "asoundconf-gtk".
lsof | grep [pcm|snd]
fuser -fv /dev/snd/*
amixer set PCM 80%
alsaplayer -i text .fluxbox/additionalapps/wmclockmon/stihl_ms2.wav
pasuspender -- speaker-test -c2 -twav -l5 -Dplughw:1,0
https://bitbucket.org/stativ/asoundconf/src/default/
https://github.com/i-rinat/apulse


bash

Rechnen

echo $[4*10]
keine Kommastellen


bzr (bazaar)

???

bzr branch ..?  # branch wählen
bzr pull        # update holen


chroot

Benutzung

chroot starten

chroot /emul/i386-testing/ [COMMAND]
schroot -d

Einrichten

Host

  • Benötigte Pakete: debootstrap, schroot
  • Partition/Verzeichnis anlegen, z.B. /emul/i386-testing/
  • Debian dort installieren:

su -c "debootstrap --arch i386 testing /emul/i386-testing/ http://ftp2.de.debian.org/debian/"

  • Verzeichnisse des Hosts, die auch vom Client verwendet werden sollen, in /etc/fstab (Host) eintragen:
# i386-testing chroot
/home   /emul/i386-testing/home none    bind      0       0
/tmp    /emul/i386-testing/tmp  none    bind      0       0
/dev    /emul/i386-testing/dev  none    bind      0       0
/proc   /emul/i386-testing/proc none    bind      0       0
  • und mounten:
mount -a
  • Benutzerdaten?

Client

  • Ins chroot wechseln:
su -c chroot /emul/i386-testing
  • bash-Prompt:
echo i386 > /etc/debian_chroot
  • Autocompletion: /etc/bash.bashrc bearbeiten
  • /etc/apt/sources.list nacharbeiten (contrib non-free)
  • (Wechsel-) Datenträger einbinden, wie Normal, da /dev ja vom Host stammt; fstab (Client):
# file system    mount point   type         options                  dump pass
/dev/sr0         /media/cdrom  udf,iso9660  noauto,ro,user,exec      0    0 
#/dev/fd0         /mnt/floppy   auto         noauto,rw,sync,user,exec 0    0
#proc             /proc         proc         defaults                 0    0

schroot

/etc/schroot/schroot.conf
schroot -c /emul/i386-testing/ -- ls -la / 
http://wiki.ubuntuusers.de/schroot
http://wiki.debian.org/Kde4schroot KDE4 auf zweitem X-Server


cmake

<D-HUND> james: can you tell me how to tell cmake to look at a specific path for a specific lib?
<james> D-HUND: some -DLIBNAME_PREFIX=/foo/bar/
-L/usr/mylib http://www.cmake.org/pipermail/cmake/2005-August/007136.html
-D CMAKE_BUILD_TYPE="Release"
-D CMAKE_INSTALL_PREFIX:PATH="$prefix"

ccmake für Menugestützte konfiguration.

 From now on, pass either -DPythonInterp_FIND_VERSION=<version> or
 -DPythonLibs_FIND_VERSION=<version> respectively in order to tell cmake to
 look for the specific Python version. However, if an explicit Python version
 is requested via find_package(), it will override the one specified on the
 command line.


dd

ddrescue: https://wiki.ubuntuusers.de/gddrescue/

dd bs=10M if= | pv --size 20G | dd bs=10M of=
killall -SIGUSR1 dd


ffmpeg

http://ffmpeg.org/

# Infos zu Containern/Streams
ffprobe file
# Bildschirm aufnehmen
ffmpeg -f x11grab -r 20 -s 1280x1024 -i :0.0+1024,0 -sameq -f mp4 output.mp4
# recording:
ffmpeg [global_options] {[input_file_options] -i input_file} ... {[output_file_options] output_file} ... 
ffpmeg -i  http://localhost:5500/screenshot?stream=y -c copy your_movie.avi # capture stream
# Danach mit kdenlive bearbeiten.
# Audiospur extrahieren (mp3):
ffmpeg -i $inputfile.avi -vn -ac 2 -ar 44100 [-ab 320k] -f mp3 $name.mp3
# Umwandeln (Video (-c[odec]:v))
ffmpeg -i infile.* [-c:a copy] -c:v libx264 -x264opts qp=27 outfile.mkv
#(-crf [0-50] # default=23, 0=beste Qualität, 50=beste Komprimierung(?))

# crop (abschneiden: breite:höhe:Ecke links oben(x:y))
https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg
-filter:v "crop=706:564:5:3"
# Animated gif http://thanosk.net/content/create-animated-gif-linux
convert -delay 50 frame1.gif -delay 100 frame1.gif -delay 150 frame1.gif -loop 0 animated.gif


gdb

~/.gdbinit für die MSPs

set remoteaddresssize 64
set remotetimeout 999999
target remote localhost:2000

Debugging für FG ([1]):

(gdb) set logging file backtrace.log
(gdb) set logging on
(gdb) run
[...]
(gdb) thread apply all bt full
(gdb) set logging off
(gdb) quit


gettext

https://www.gnu.org/software/gettext/manual/html_node/

de_DE: https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html#Locale-Names

source(s) --> .pot --> .po

source

...

.pot files

xgettext -o $file.pot -L shell source1 [source2 ...]
   # Erzeugt de.po aus den Quellen (pot-input == Liste der zu durchkämmenden Dateien)
   -L shell   # Syntax für Shell-Skripte anwenden (z.B. suchen nach: $"..."

.po files

msginit --locale=de_DE --input $file.pot   # Erzeugt de.po aus $file.pot
gtranslator   # Editor for .po files
mv de.po de.po-alt; msgmerge -o de.po de.po-alt $file.pot
   # de.po updaten, wenn sich file.pot geändert hat.
msgcmp de.po $file.pot   # Vorlage und Übersetzung vergleichen.


git

Einige nützliche Befehle für git am Beispiel der FlightGear-Quellen. Alle Befehle werden innerhalb des zielverzeichnis ausgeführt, ausgenommen das erste der hier aufgelisteten.

Repos clonen und verwalten

Ein entferntes (remote) git-Repo zu einem lokalen Repo clonen/nachbilden/vervielfältigen:

git clone git://gitorious.org/fg/flightgear.git [zielverzeichnis]
  • Das zielverzeichnis wird erstellt und darin das neue Repo abgelegt.
  • Eine Wiederaufnahme eines abgebrochenen Clonen ist nicht möglich.


Update eines lokalen Repos vom entfernten:

git pull


Die im geclonten Repo enthaltenen Branchen anzeigen:

 git branch -a
  • branch Branchen auflisten, erstellen oder entfernen
  • -a listet alle, also die lokalen und die des entfernten Repos, auf. Das mit dem Sternchen * gekennzeichnete Repo ist das z.Zt. aktive.


Eine lokale aus einer entfernten Branch erzeugen:

git checkout -b master origin/master
  • checkout - Checkout a branch or paths to the working tree
  • -b erzeugt eine neue Branch. Diese wird gleichzeitig als aktiv markiert.
  • master ist die neue Branch,
  • origin/master ist die Vorlage.


Eine Branch aktivieren. Diese ist also die, welche im Arbeitsverzeichnis dargestellt wird.

git checkout next


Die Tags, also Markpunkte der Versionsgeschichte, einer Branch auflisten:

git tag


Tags aktivieren wie Branchen:

git checkout v2.0.0


Lokale Änderungen in den Quellen

Am Beipiel vom FlightGear-data Repo in der next, also der bleeding edge, Branch.

Die lokale Branch master clonen:

git checkout -b master.local master
  • In die Branch master.local können nun eigene Veränderungen eingepflegt werden. Diese ist dann auch das dargestellte data-Verzeichnis zur Benutzung mit FG.
git status
will give you a list of files that have been altered or that are new.
git add -i
[a]dd will add new paths/files (called untracked in status) from the working tree to the index. This has to be done only if you have added paths/files, like an aircraft, to the working tree. man git add
[u]pdate is the next step and will update the altered and tracked files to the index in the same manner as add does.
git commit
will commit the indexed updates to the master.local branch. It opens a list of the updates in your standard editor.
git rebase -i HEAD~5
Die letzten fünf commits bearbeiten.

<timoore> D-HUND: The first step -- creating the new branch -- is fine. Afterwards you need to commit your changes, which is a two step process -- git add and git commit. For files that git knows about (you've already added them once), you can type "git commit -a" which will automatically do the "git add" step on all changed files. AndersG 'd avoid use of -a <AndersG> git status + a deliberate git add is better for detecting problems <pigeon> i pretty much only use git add -p these days.

Änderungen des entfernten Repos ins eigene übernehmen:

git checkout next       # Ins Hauptrepo wechseln
git pull                # und selbiges updaten.
git checkout next.own   # Ins lokale Repo wechseln
git rebase next         # und dieses dann updaten.

<AndersG> Brandano: If you don't use your local master for anything you could replace that with: git fetch; git rebase origin/master <AndersG> When on local

Konfiguration

git config --global user.name "Your Name"
git config --global user.email you@example.com

Weitere

git help
git help [commad]
git checkout -f
-f When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes, auch wenn das gesamte Arbeitsverzeichnis, ausgenommen der .git Ordner, gelöscht wurde.
git checkout master.local; git diff master [pfad/datei(en)] > datei.diff
git apply --index [-R] datei.diff; git commit
Apply a patch to files and/or to the index http://www.kernel.org/pub/software/scm/git/docs/git-apply.html
'--index' Änderungen auch in den Index schreiben
'-R' reverse, rückgängig machen
git gc
git remote set-url --add [origin] [2]
git reset [--hard]
throw away any 'unstaged changes'
git reset --hard HEAD~1
go back one commit


git-svn

git-svn Repo anonym initialisieren, am Beispiel eines Flugzeugs aus fgaddon:

mkdir Aerostar-700; cd Aerostar-700
git svn init svn://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft/Aerostar-700
git svn fetch

Updates holen:

git checkout master
git svn rebase


grml

grml-quickconfig
/etc/init.d/ssh start
echo "root:test7" | chpasswd

grml2usb

2011.12 "Knecht Rootrecht" installieren

Partitionen anlegen:

fdisk -l /dev/sdb
Disk /dev/sdb: 1031 MB, 1031675904 bytes
...
   Device Boot   Start      End  Blocks   Id  System
/dev/sdb1   *       63  1333394  666666    6  FAT16     # "grml96" 655 MiB
                                                        # "grml32" 320 MiB 
/dev/sdb2      1335296  2013183  338944    5  Extended
/dev/sdb5      1337344  1951743  307200   83  Linux     # "home-rw" ext3
/dev/sdb6      1953792  2013183   29696   83  Linux     # "live-rw" ext3
GRMLCFG
<debdog> therefore next question: what could possibly go into GRMLCFG that can't live in home-rw or live-rw?
<debdog> but reading http://grml.org/config/grml-autoconfig.1.html i could not find anything
<mika> debdog: grml.sh, don't care about the rest IMHO

/dev/sdb7                                               # "GRMLCFG" ext3 (5 MiB, grml.sh))
Gibt es einen Grund für ext3, wie in [2] beschrieben, wäre ext2 nicht besser für kleine Datenträger?
<MirWRT> the journal
<MirWRT> = less data loss (hopefully) and less need for fsck on sudden-unplug
<MirWRT> which isn’t all that rare with usb sticks


cd ~/src/grml2usb && git pull
su -c './grml2usb --bootoptions="%grml32 %grml64 persistent lang=de swap ssh=passwort nobeep " \
   /pub/images/grml96_2011.12.iso /dev/sdb1'
[autoconfig] [--bootloader-only --syslinux-mbr]

testen: bootfrom=removable-usb
keyboard=de xkeyboard=de

--bootoptions= "cheatcodes"

[1] http://grml.org/grml2usb/
[2] http://wiki.grml.org/doku.php?id=persistency

Problem
<debdog> I am not able to create a grml32 only usb drive with grml2usb v0.11.3 and younger
<debdog> ./grml2usb --bootoptions="%grml32 persistent lang=de swap ssh=passwort nobeep" /pub/images/grml96_2011.12.iso /dev/sdb1


hdparm

hdparm [-C|-t|-I|-v] /dev/sda
-C zeigt den 'drive state'
-t 'Perform timings of device reads for benchmark and comparison purposes.'
-I zeigt 'identification info'
-v zeigt 'current settings'
hdparm -S 252 -M 254 -W [0|1] /dev/sda

/etc/hdparm.conf


html2ps

html2ps -T -F -n -D -o file.ps [file|URL]
-T nur Text, bilder werden ausgelassen
-F Rahmen um den Text
-n Seiten nummerieren
-D GhostView-kompatibel. Siehe manpage!
-o output file


hwinfo

Asführen bevor (der X-Server/KMS?) gestartet wird:

hwinfo --framebuffer

Alternative:

# --> https://github.com/wfeldt/mdt
aptitude install libx86emu-dev
git clone git://github.com/wfeldt/mdt.git mdt.git
cd mdt.git
make
cp mdt /usr/local/sbin/
su -c "mdt --modes"


jscal

jscal -c /dev/input/by-id/usb-06a3_Saitek_Cyborg_USB_Stick-joystick


lshw

-C multimedia


mount

http://www.volkerschatz.com/unix/advmount.html

Images

losetup /dev/loop0 Image.img
fdisk -l /dev/loop0
mount -o loop,offset=XXX Image.img /mnt
losetup [-D|-d /dev/loopX]


mplayer/mencoder

mplayer -fs -aid ID [-nosub|-noautosub|-sid ID] -aspect 16:9 file [file ...]
'-fs' fullscreen
'-aid ID' Audiospur (Audio ID) wählen.
'-sid ID' Untertitel wählen
'-noautosub' Untertitel nicht automatisch laden.
(-ass* ?)
'-sub <subtitlefile1,subtitlefile2,...>'
'-subdelay seconds'
'-zoom -xy [0…8]' Video skalieren
'-vf <...,filter2,filter1>' Video filter
'flip' horizontal spiegeln
'mirror' vertikal spiegeln
'rotate=[0-7]'
0: 90° Uhrzeiger, spiegeln
1: 90° Uhrzeiger
2: 90° gegen Uhrz.
3: 90° gegen Uhrz., spiegeln
'screenshot' Screenshot, Taste s
mplayer -identify -frames 0  # entspricht -msglevel  identify=4 -frames 0
mplayer cdda:// /dev/sr0     # Audio-CD
# Videospur aus Datei extrahieren:
mencoder $input.avi -o $name.$codec -nosound -ovc copy
# Audiospur aus Datei extrahieren:
mencoder $input.avi -o $name.$codec -of rawaudio -ovc copy -oac [copy|mp3lame]
# Video- und Audiospur verbinden:
mencoder $inputvideo.avi -audiofile inputaudio.mp3 -oac copy -ovc copy -o $output.avi
'-oac help' output audio codec


Streams

mplayer http://www.rockantenne.de/webradio/rockantenne-aac.pls
mplayer http://mp3-live.swr.de/swr1bw_s.m3u
mplayer http://mp3-live.swr3.de/swr3_s.m3u
mencoder -oac lavc -ovc lavc vcodec=msmpeg4:vbitrate=1800:vhq:keyint=250 -o $file


qemu

https://qemu.weilnetz.de/doc/qemu-doc.html
Mouse-grab-keys (MGK), default: Ctrl-Alt
Switch to monitor: MGK-Shift-2
Switch back to guest: MGK-Shift-1
https://en.wikibooks.org/wiki/QEMU/Monitor

qemu-system-[i386|x86_64] -enable-kvm -cpu host -smp 4 -m 4096 -localtime -soundhw es1370 \
-hda /pub/qemu/Devuan_ASCII_Spielwiese.qcow2 -cdrom /dev/cdrom -boot c -vga virtio\
-netdev user,id=mynet0,net=192.168.178.0/24,dhcpstart=192.168.178.9,hostname=emu,hostfwd=tcp::55522-:22 \
-device e1000,netdev=mynet0
-boot a          # a: floppy | c: HDD | d: CDROM
-bios /usr/share/qemu/OVMF.fd   # UEFI, benötigt -enable-kvm
-device          # NIC Intel e1000, verbunden mit backend "mynet0"
-monitor stdio   # -monito <dev>, device for the monitor
-netdev          # Netzwerk-backend, Gast per DHCP
  # hostfwd: 55522=hostport, 22=guestport
-vga vmware      # xserver-xorg-video-vmware
-vga [virtio|cirrus|std|none]
qemu-img create -f qcow2 /pub/qemu/Wheezy64.qcow2 3G
qemu-img resize /pub/qemu/Wheezy64.qcow2 [+|-]1G
qemu-img snapshot -l(ist) -c(reate) -d(elete) -a(pply, auswählen) $snapshot /pub/qemu/Wheezy64.qcow2
nfs

http://www.cnx-software.com/2011/10/02/how-to-transfer-files-between-host-and-qemu-via-ssh-and-nfs/
Host, /etc/exports:

/pub            *(rw,insecure)   # fuer qemu-Gaeste

Gast:

mount $HOST_IP:/pub /mnt


Netzwerk

ssh http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Netzwerkoptionen/_Virtuelle_Netzwerke_konfigurieren#User_Mode_Network_Stack
user@host:$ ssh ax@localhost -p 55522
nbd http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Speichermedien/_Network_Block_Devices
Gast: nbd-server installieren
Host: nbd-client installieren


ripit

ripit -e -c 2 -q 0 -d /dev/sr0 -o /pub/musi [tracks]
-e: eject
-c: 0=lame; 1=oggenc; 2=flac
-q: Quality (ogg 10; mp3 0; flac 8)
http://de.wikipedia.org/wiki/Liste_der_ID3v1-Genres
http://www.freedb.org/
CDDBMETHOD=cddb CDDBURL=freedb.freedb.org:8880 HELLOINFO=RipIT@www.suwald.com/ripit/ripit.html abcde -d (/dev/sr0?) eject directory datenbank -j ($nproc) -o mp3:"-q 0"(?)
# RipIT@www.suwald.com/ripit/ripit.html running RipIT 3.9.0


rsync

rsync [options (-aX)] SRC [DEST]
-a = -rlptgoD
-g preserve group
-l copy symlinks as symlinks
-o preserve owner (super-user only)
-p preserve permissions
-t preserve modification times
-r recursive
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
-X preserve extended attributes
--del an alias for --delete-during
--delete delete extraneous files from dest dirs
--delete-during receiver deletes during xfer, not before
rsync -aX --del /home/ax /media/sdb2/ax.rsync


S.M.A.R.T.

smartctl -t long /dev/sdX
smartctl -l /dev/sdX


SSL (openssl)

man openssl
man s_client
man x509


svn

svn update -rXXX
XXX ist die Revisionsnummer


tar

tar -c -j [--directory=/home/] [--ignore-failed-read] -f home_ax_bcp.tar.bz2 /home/ax
tar tvf datei 
-t list, Inhalt anzeigen


tee

<command> 2>&1 | tee <file>


tune2fs

tune2fs -l /dev/sdXX        # derzeitige Parameter für das angegebene Dateisystem auflisten
tune2fs -m 0 /dev/sdXX      # reservierte Blöcke für root auf 0 setzen
tune2fs -L label /dev/sdXX  # Name (label) der Partition festlegen


undelete

extundelete - utility to recover deleted files from ext3/ext4 partition
über die inode: http://archive09.linux.com/feature/58142


wine

Icons: icoutils --> wrestool

wrestool -l name.exe
wrestool -x -o ~/.fluxbox/icons/ [--raw] name.exe

Danach müssen evtl. noch die Lagen (unterschiedliche Grössen) getrennt werden --> The Gimp.

Umgebungsvariablen:

WINEPREFIX=path
WINEARCH=[win32|win64]
USERNAME=admin

Problem:

err:d3d_caps:WineD3D_CreateFakeGLContext Can't find a suitable iPixelFormat.
err:d3d:InitAdapters Failed to get a gl context for default adapter
fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 16
err:ddraw:CreateSurface Failed to create swapchain, hr 0x8876086c.
err:d3d_caps:WineD3D_CreateFakeGLContext Can't find a suitable iPixelFormat.
err:d3d:InitAdapters Failed to get a gl context for default adapter
fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 16
err:ddraw:CreateSurface Failed to create swapchain, hr 0x8876086c.

Lösung:

<Jester01> for 32 bit compat, you need /usr/lib32/fglrx/fglrx-libGL.so.1.2
<Jester01> probably not the recommended method, but rename /usr/lib32/libGL.so.1.2
           and make it a symlink to /usr/lib32/fglrx/fglrx-libGL.so.1.2
declare -x LIBGL_DRIVERS_PATH="/usr/lib32/dri:/usr/lib/dri"

[w1]http://wiki.winehq.org/UsefulRegistryKeys


X

xorg.conf

https://www.x.org/archive/X11R6.8.1/doc/xorg.conf.5.html

xorg.conf
├── Section "ServerLayout" (multiple)
│   ├── Section "Screen"
│   │   │   └── SubSection "Display"
│   │   ├── Section "Device"
│   │   └── Section "Monitor"
│   │       ├── Section "Modes"
│   │       └── Section "Vendor"
│   └── Section "InputDevice"
├── Section "ServerFlags" (once)
├── Section "Module" (once)
├── Section "Files" (once)
└── Section "DRI" (once)


"Hinterkopf"

free -m   # actually needed = used - buffers - cache
furiusisomount   # mehrere Images mounten etc.
ltrace   # A library call tracer
smem
xterm -T xs3 -bg black -fg gray80 -fn 10x20 -geometry 101x30+0+0 -e ssh -t xs3 screen -RRD