- Collection of Information for those with Electronics as a Hobby
Up one level (Linux)

Linux command line

Here is a collection of specific commands that at times can be useful.

Add device to driver while runningBackup File System Using Tar
Change background from command line (CLI) in GnomeChange permissions on all folders only (recursively chmod)
Check which ip addresses are used in local network (ping all ips in subnet)Concatenate pdf files
Create Ubuntu PackageDecode mp3 file to raw audio data for using with a pipe
Download all URLs in one fileELF debugging and manipulation
Encode to x264 video formatFFmpeg
Forward TCP portGdal
GstreamerMake .deb package from control.tar.gz, data.tar.gz etc.
Make a4 size pdfMake vim restore last line position
Make Xvid from .iso file or DVDMencoder join videos
MidiMove last opened window to specific position on screen
Move root file system to new partitionMutt
Numerize the output from a pipeNvidia GPU overclocking
Play raw files with mplayer under LinuxPolicy based routing Linux
Put webcam on TCP portRead the image from an RFID passport in Linux
Record system output sound in Linux with pacat (Pulseaudio)Reinstall grub
Subversion commandsTurn on/off monitor

nr=1920; for i in `wmctrl -lx | grep Navigator.Firefox |cut -c -10` ; do wmctrl -i -r $i -e 0,$nr,0,640,1080  ; nr=$(($nr+640)) ; done

adb shell screencap -p /sdcard/screen.png

android update sdk --no-ui


x=1 ; for files in *.jpg ; do convert -resize 1024 $files mini/$x.jpg ; x=`expr $x + 1` ; done
avconv -y -i %d.jpg -b:v 5M -r 30 test.mp4

sed 's|>[[:space:]]*<|>\n<|g' inputfile

pygmentize  -f html -O full file_to_highlight.c > test.htm

gsettings set org.gnome.settings-daemon.plugins.power button-power 'hibernate'

pacmd list-sink-inputs
pacmd move-sink-input 1 1
pacmd set-sink-volume 1 65000
pacmd set-sink-input-volume 1 65000

GatewayPorts yes   -> /etc/ssh/sshd_config
ssh -R 6333:localhost:22
su username -c "screen -d -m ssh -R 6333:localhost:22"

AllowTcpForwarding yes -> /etc/ssh/sshd_config

startx -- :0 vt07 -layout Layout0 -novtswitch
startx -- :1 vt08 -layout Layout1 -novtswitch -sharevts

qpdf --decrypt input.pdf output.pdf

[Desktop Entry]
Exec=nautilus filename

dbus-send --system --dest=org.freedesktop.ConsoleKit --type=method_call \
  --print-reply  --reply-timeout=2000 /org/freedesktop/ConsoleKit/Manager \

dbus-send --system --dest=org.freedesktop.ConsoleKit --type=method_call \
  --print-reply  --reply-timeout=2000 /org/freedesktop/ConsoleKit/Manager \

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

setxkbmap de

aptitude hold packagename
or: echo packagename hold | dpkg --set-selections 


taskset -c 0    # Let the program only see one CPU core

HandBrakeCLI -i title02.mkv -o out.mkv -e x264 -s 1,2 \
-x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0:ref=1:subme=2:me=dia:\
analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0:weightb=0 \
-b 1500 -2 -E faac -B 320 -T

HandBrakeCLI -i title00.mkv -o output.mkv -e x264 -a 2 --pixel-aspect 64:45 -l 424

makemkvcon mkv disc:0 0 


diff -Naur a b > patchfile.patch

patch -p1 < ../patchfile.patch

insert into kategorier (hjelpeid,sysid) select 57,id from systematikk as o where o.latin like "Nepenthes%" and not in (select sysid from kategorier where hjelpeid=57);

echo -ne "\x02" > output.raw

vim /lib/modules/2.6.32-40-generic-pae/modules.usbmap

RewriteEngine On 
RewriteRule ^(.*)$ big_image_folder.php [L]

growisofs -use-the-force-luke=notray -use-the-force-luke=4gms -dvd-compat -speed=16 -use-the-force-luke=tracksize:826845 -use-the-force-luke=tty -Z /dev/sr0 /proc/self/fd/0
/usr/bin/genisoimage -input-charset utf8 -r -J -graft-points -path-list /tmp/brasero_tmp_NX2MBW -exclude-list /tmp/brasero_tmp_QZ2MBW -V VOLUMENAME -A Brasero-2.30.2 -sysid LINUX

awk '{ sub("\r$", ""); print }' filein.txt > fileout.txt

env CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure

echo "set mark-symlinked-directories on" >> ~/.inputrc

dvdbackup -i /dev/dvd -o ~ -M

find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz

awk '!($0 in array) { array[$0]; print }' temp

# This is an awk program that summarizes a coin collection.
   /gold/    { num_gold++; wt_gold += $2 }      # Get weight of gold.
   /silver/  { num_silver++; wt_silver += $2 }  # Get weight of silver.
   END { val_gold = 485 * wt_gold;              # Compute value of gold.
         val_silver = 16 * wt_silver;           # Compute value of silver.
         total = val_gold + val_silver;
         print "Summary data for coin collection:";  # Print results.
         printf ("\n");
         printf ("   Gold pieces:                   %2d\n", num_gold);
         printf ("   Weight of gold pieces:         %5.2f\n", wt_gold);
         printf ("   Value of gold pieces:        %7.2f\n",val_gold);
         printf ("\n");
         printf ("   Silver pieces:                 %2d\n", num_silver);
         printf ("   Weight of silver pieces:       %5.2f\n", wt_silver);
         printf ("   Value of silver pieces:      %7.2f\n",val_silver);
         printf ("\n");
         printf ("   Total number of pieces:        %2d\n", NR);
         printf ("   Value of collection:         %7.2f\n", total); }

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1


blahblah > /dev/null 2>&1

apt-cache showpkg libosmgpsmap2

chmod -R g+swX MyPlants

android update sdk --no-ui

sudo visudo
Defaults    env_reset,!tty_tickets 
<- add this and it's not necessary anymore to enter password every time sudo is used

GatewayPorts clientspecified  # or yes   in /etc/ssh/sshd_config

sudo apt-get install resolvconf
sudo vim /etc/resolvconf/resolv.conf.d/base  -> add "options single-request-reopen"

deb [arch=amd64,i386] quantal main universe

sed -i 's/deb http/deb \[arch=amd64\] http/' /etc/cron.daily/google-chrome

kpartx -a raspberry-backup-2014-04-10.img

Add a comment:

Fill in number

Privacy | Contact