Useful things ...
blacklist nouveauthen update initramfs
update-initramfs -u
screen rsync foo bar
With CTRL+A d you detach the screen. Another method is to detach the screen by id with
screen -d SCRENID
With
screen -ls
you can list all running screen processes. With
screen -r SCREENID
you can attach the screen again where you get the SCREENID from command screen -ls.
rsync -avze ssh /home/user remoteserver:/home/user <password input> <ctrl>-z bg disown -h
The last command tells shell that it should not send signal SIGHANGUP.
IO Tuning documentation found here.
cat /sys/block/sda/queue/scheduler noop deadline [cfq]
sudo add-apt-repository ppa:bumblebee/stable sudo apt-get update sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic
Reboot your laptop. These steps were found on this site.
dpkg -l > dpkg.out scp dpkg.out remotehost.com: ssh remotehost.com cat dpkg.out | sed "s/ii..//" | sed "s/ [0-9].*//" | xargs -ixxx echo "yes | apt-get install xxx ;" > todo.sh vim todo.sh
You have to delete the first 5 lines.
cat todo.sh | sh
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf
On Debian based system use these definitions before building:
LIBRARY_PATH=/usr/lib/$(gcc -print-multiarch) CPATH=/usr/include/$(gcc -print-multiarch) export LIBRARY_PATH CPATH
chrome://plugins/
The configuration that was loaded at boot up differs from the current one. The boot process stopped with
initramfs: cat /etc/mdadm/mdadm.conf
The solution was
sudo update-initramfs -u
for i in `seq 1 16`;do echo ssh -X cluster$i.domain.com xterm \&;echo sleep 1;done | sh
screen -dm -S session1 vim screen -dm -S session2 htop screen -ls
screen -r 4711
crti.o: No such file or directory
Message "asm/errno.h: file not found"
see here for installation steps.
aptitude install vsftpd gvim /etc/vsftpd.conf ftp localhost
mkdir /srv/ftp/pub mkdir /srv/ftp/pub/upload
sudo mount /dev/sde3 /mnt/sys sudo grub-install --root-directory=/mnt/sys /dev/sde Installation finished. No error reported. This is the contents of the device map /mnt/sys/boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. sudo umount /mnt/sys
mplayer asdf.avi -vc null -vo null -ao pcm:fast:file=asdf.wav
Now normal user can go to /etc directory (may be to all other directories) and if there is read only permission to sensitive files user can download the file via ftp.
To avoid this security problem you can lock ftp user in a jail.
Open vsftpd configuration file - /etc/vsftpd/vsftpd.conf
vi /etc/vsftpd/vsftpd.conf
Make sure following line exists (and uncommented):
chroot_local_user=YES
Save and close the file. Restart vsftpd.
/etc/init.d/vsftpd restart
Now all users of VSFTPD/FTP will be limited to accessing only files in their own home directory. They will not able to see /, /etc, /root and /tmp and all other directories. This is an essential security feature.
tar cfv - file | gpg --symmetric --cipher-algo AES256 -o output.gpgThis packs file and prints it to STDOUT. gpg takes it there and encrypts it and puts it into file output.gpg.
tar cfjv - /srcfolder | ssh user@remotehost tar xfjv - -C /home/user/destfolder
sudo aptitude install libnss3-dev ./configure --enable-gnutls=yes --disable-screensaver --disable-startup-notification --disable-gtkspell --disable-gstreamer --disable-meanwhile --disable-dbus --disable-perl --disable-tcl make make install
Sending file to Nokia 6680 memory card
sudo obexftp -u 1 -c E:/Sounds -p /tmp/asdf.mp3
List files
sudo obexftp -u 1 -c E:/Sounds -l
To get rid of the sudo you could change access rights as follow:
sudo /dev/bus/usb -type c -exec chown root:users \{\} \;
setterm -blank 0
X server screen blanking: xset s off
To create a image that vmware can read just type:
qemu-img create -f vmdk 40gb.vmdk 40G
and write into the vmx file:
ide0:0.filename="40gb.vmdk"
sudo apt-get install lame
Type the following command
arecord -f cd -t raw | lame -x – out.mp3
Arecord captures the audio that goes through your computer and pipes it to the lame encoder, so you encode the audio directly to an mp3 file. You can specify more options to the lame encoder such as the bitrate with lame -x -b bitrate. Without specifying the bitrate it encodes to 128kbps constant bit rate cbr. If you want to record for an specific amount of time then:
arecord -f cd -d numberofseconds -t raw | lame -x – out.mp3
Recording sound to an ogg file
You’ll need the oggenc (the ogg encoder). Install it by doing
sudo apt-get install vorbis-tools
Type the following command
arecord -f cd -t raw | oggenc - -r -o out.ogg
And you’ll get your sound recorded to an ogg file. Take into account that we record directly to a compressed file, so there’s nothing in between, so you can record for hours saving an incredible amount of hard disk space.
If you want to rip a radio stream coming over internet you can use streamripper. Attent that this method is prohibited in some states. Ripping shoutcast audio streaming. Streamripper allows us to rip audio streaming servers. Install it by typing
sudo apt-get install streamripper
You can connect to any shoutcast radio station with xmms. Once playing get the info and write down the url. Then type:
streamripper url
For download youtube videos or audio dumps you can use the python script 'youtube-dl'.
aptitude install youtube-dl mplayer -dumpaudio $(youtube-dl -g http://www.youtube.com/watch?v=idofwantedvideo) mplayer -quiet -vo null -vc dummy -ao pcm:waveheader:file="rawaudio.wav" stream.dump oggenc rawaudio.wav mv rawaudio.ogg nameuwant.ogg
The other way around is similar or even aquivalent.
## awsomelist mailing list awsomelist: "|/var/lib/mailman/mail/mailman post awsomelist" awsomelist-admin: "|/var/lib/mailman/mail/mailman admin awsomelist" awsomelist-bounces: "|/var/lib/mailman/mail/mailman bounces awsomelist" awsomelist-confirm: "|/var/lib/mailman/mail/mailman confirm awsomelist" awsomelist-join: "|/var/lib/mailman/mail/mailman join awsomelist" awsomelist-leave: "|/var/lib/mailman/mail/mailman leave awsomelist" awsomelist-owner: "|/var/lib/mailman/mail/mailman owner awsomelist" awsomelist-request: "|/var/lib/mailman/mail/mailman request awsomelist" awsomelist-subscribe: "|/var/lib/mailman/mail/mailman subscribe awsomelist" awsomelist-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe awsomelist"
To delete the list you can only delete the list entries or the complete archive:
rmlist awsome rmlist -a awsome
for i in *.jpg;do convert -rotate 90 $i $i-rotated.jpg;done
for i in *.jpg;do convert $i $(asename $i .jpg).tiff;done
convert image.jpg -crop 100x100+500+1000 output.jpg
convert image.jpg -crop 16+500+1000 output.jpg
convert image.jpg -gravity SouthWest -crop 160x90+0+0 output.jpg
convert original.tiff mask.tiff +matte -compose CopyOpacity -composite output.png
convert background.tiff foreground.png -compsite output.tiff
which wpa_supplicant
wpa_passphrase youressid secretpassphrase
# /etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 eapol_version=1 ap_scan=1 fast_reauth=1 # WPA-PSK network={ scan_ssid=1 proto=WPA key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP WEP104 WEP40 ssid="myessid" #psk="meinegeheimepassphrase" psk=6f115e30ef7e7eb6c253033709e8864e43894e3df2159f00b99150d69113439a priority=2 }
If you want AES instead of TKIP take changes at line where group and pairwise are assigned.
chmod 600 /etc/wpa_supplicant.conf
Now we test the configuration with:
wpa_supplicant -dd -K -t -i wlan0 -D wext -c /etc/wpa_supplicant.conf
If everything is fine you can stop debug mode and start normal background mode with:
wpa_supplicant -Bw -i wlan0 -D wext -c /etc/wpa_supplicant.conf
For automatically start/stop mechanism make this entries in /etc/network/interfaces:
auto wlan0 iface wlan0 inet dhcp post-up wpa_supplicant -Bw -i wlan0 -D wext -c /etc/wpa_supplicant.conf post-down killall wpa_supplicant post-down rm -r /var/run/wpa_supplicant/
or without dhcp
iface wlan0 inet static address 192.168.1.160 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
First make sure you have enabled Executeable file formats/IA32 emulation.
debootstrap --arch i386 sid /var/chroot/sid-ia32 http://ftp.debian.org/debian/
or
debootstrap --arch i386 dapper /tmp/minibuntu http://archive.ubuntu.com/ubuntu
or
debootstrap --arch i386 gutsy /var/chroot/gutsy-ia32 http://archive.ubuntu.com/ubuntu apt-get install libx11-6 apt-get install firefox
Then mount for the chroot env the following from amd64 env:
# sid32 chroot /home /var/chroot/sid-ia32/home none bind 0 0 /tmp /var/chroot/sid-ia32/tmp none bind 0 0 /dev /var/chroot/sid-ia32/dev none bind 0 0 /proc /var/chroot/sid-ia32/proc none bind 0 0 i="/var/chroot/sid-ia32/";for j in home tmp dev proc;do mount $i$j;done useradd myuser su - myuser env DISPLAY=:0 /usr/bin/firefox
I do the above sequence for watching videos with adobes flash player. That runs ok but unfortunatelly without sound. That's a problem I am not able to solve. On console there are many alsa lib errors which say that my sound device is unknown.
Do not forget the second input of ISO-8859-1. Without the pair you will get a "bad entry" output while locale-gen execution.
Briefly:
openssl genrsa -aes128 1024 > server.key openssl req -new -key server.key -out server.csr
openssl ca -in server.csr -notext -out server.cert
or if last step doesnt work:
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.cert chmod 600 server.cert
Add
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.cert SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
into /etc/httpd/conf.d/ssl.conf or
SSLCertificateFile /etc/apache-ssl/server.crt SSLCertificateKeyFile /etc/apache-ssl/server.key
into httpd.conf
Important is that you do not use a cipher as private key if you want to prevent a pass-phrase input every time you start apache server.
openssl rsa -in server.key -out server2.key
While the mod-ssl installation there are five folders created
A good step-by-step docu can be found here. Another one here.
A brief version of this docu here:
openssl genrsa -des3 -rand file1:file2:file3 -out www.example.com.key 1024 openssl req -new -key www.example.com.key -out www.example.com.csr openssl x509 -req -days 30 -in www.example.com.csr -signkey www.example.com.key -out www.example.com.cert
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl $ sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl
/etc/apache2/sites-enabled/ssl:
NameVirtualHost *:443 <VirtualHost *:443> SSLEngine On SSLCertificateFile /etc/apache2/ssl/www.example.com.cert SSLCertificatekeyfile /etc/apache2/ssl/www.example.com.key SSLProtocol +all SSLCiphersuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL ... </VirtualHost>
/etc/apache2/ports.conf :
Listen 443
Activate ssl:
$ sudo a2enmod ssl
Restart apache server:
sudo apache2ctl restart
In /usr/share/zoneinfo you find many file of cities and places of the world. For example with
TZ=Canada/Eastern date
you can switch your timezone for the call of date program to canada eastern time.
find -size -100k
ls -l --color='never' | grep -e "[0-9]\{3\}K\ 2007" | sed s/.*[0-9][0-9]:[0-9][0-9]\ \\\(.*\\\)/\rm\ \"\\\1\"/
# wvdialconf /etc/wvdial.conf # vim /etc/wvdial.conf
# wvdial
/usr/bin/gnome-terminal --command="/bin/sh -c \"find / -name *.mp3\""
nvidia Treiber diese Funktion nur benötigt, wenn CONFIG_HIGHPTE eingeschaltet ist FIX: 'make menuconfig' in the linux source dir, disable the "Paravirtualization support" option, and do 'make prepare'. Now run the NVidia installer script and update xorg.conf.
ifconfig eth0 hw ether aa:bb:cc:dd:ee:ff
ifconfig eth0:1 <ipaddress> netmask <netmask>
/usr/bin/nmap -sP -f 192.168.0.0/27 | grep 192.168.0. | sed s/.*\\\(192\.168\.0\.[0-9]*\\\)\).*/\\\1/g
For simple control of a second computer on which runs X is X2X the best way. Install x2x on the control host. Then start a ssh session from the remote host to the control host with
ssh -X controller
and start x2x with
x2x -from :0 -north
where -north gives the direction where the remote host is from the point of view of the controller. You can put these commands together:
ssh -X controller /usr/bin/x2x -from :0 -north
Afterward you can control your computer as always and if you get with the mouse pointer to the upper end of the screen the signals to the X server will be sended to the remote host and you can control it.
make && make modules && make modules_install cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.19.2 mkinitrd -o /boot/initrd.img-2.6.19.2 2.6.19.2
and don't forget to enable cramfs (File systems->Miscellaneous->cramfs) into kernel!
Do you have more than 1 gigabyte memory? Then test if the kernel just use it with
cat /proc/meminfo
As I build in the new sticks and have total mem of 2 gigabyte and only found 1 gigabyte in the info I search for a kernel property and found it under "Processor type and features" and has the name "High memory support". Enabling this to 4gb and recompiling the kernel brings the full support of 2 gigabyte. I just wonder why this option was not enabled before.
command: | function |
convert -geometry 1024x765! | resize picture exactly to 1024x765 |
free | gives description of memory use what is also under /proc/meminfo |
strace | takes command as parameter and strace tells about system function calls |
lsof -p PID | open files of process PID see further: lsof parameter |
lsof /path | open files under path |
vmstat | shows overview about read and write accesses from block devices. si for data that comes from device and so for data that goes to device. swap for swap devices. |
vmstat -p /dev/hda5 | show only partition hda5 |
lshal | gives infos about almost every part that is built-in inner the pc |
echo governor > /ss/devices/system/ cpu/cpu0/cpufreq /scaling_governor | sets the governor for cpu0. examples are: ondemand or conservative for laptops in battery mode |
systool | overview about sysfs file system |
watch -n1 command | calls command inner a endless loop until you press ctrl-c |
nmap | powerful network analyzer. For details see below. |
-sP 192.168.0.0/24 | Pingscan |
-sT | TCP Scan mit initialem Ping |
-sN | Null Port Scan |
-sI | Idle Scan over second host |
-sU | UDP scan |
-f | strong fragmentation |
-s | spoofing: hide ip |
-o | try to recognize os |
-sS | SYN stealth port scan |
-F | only scan ports in nmap port list |
-name '*.ogg' | find all ogg files recursively |
-exec rm {\} \; | deletes all files that were found. For {\} will be the name substituted that has been found |
-ctime 2 | matchs all files that creation time is older than 48 hours (2*24) |
-amin +300 | File was last accessed more than 5 hours ago |
-amin -300 | File was last accessed in the last 5 hours |
If you want to delete file with name "-foobar.txt" the command rm takes the file name as parameter. To prevent this is to write ./-foobar.txt or "rm -- -foobar.txt"
dd if=/dev/urandom of=random-numbers.bin bs=4194304 count=1024
creates a file with random numbers with a size of 4gb (blocksize 4mb and 1024 blocks)
The command
wget -r -l 128 --wait=2s ftp://user:password@ftpsite/dir
gets directory recursively up to level 128 and waits 2 seconds between files.
$umount /dev/cdrom umount: /cdrom:device is busy $ kill -9 `lsof -t /dev/cdrom` $ umount /dev/cdrom $ eject
search for open ports:
lsof -a -i -u www-data | grep LISTEN
A template looks like this:
#!/bin/sh # or bash case "$1" in start) echo "Starting asdf" /usr/bin/asdf & pidof asdf > /var/run/asdf.pid ;; stop) echo "Shutting down asdf" killall asdf /bin/rm /var/run/asdf.pid ;; restart) $0 stop $0 start ;; status) if /sbin/checkproc /usr/bin/asdf 2> /dev/null # if pidof asdf > /dev/null then echo "asdf is up" else echo "asdf is down" fi ;; esac
Do you want to copy or clone a ready to use installation for some other use? Then use:
VBoxManage clonevdi ready-install.vdi new.vdi
sudo sh -c 'echo "# VirtualBox repository for Ubuntu Feisty Fawn deb http://www.virtualbox.org/debian feisty non-free" > /etc/apt/sources.list.d/feisty-virtualbox.list' wget http://www.virtualbox.org/debian/innotek.asc -O- | sudo apt-key add - sudo apt-get update sudo apt-get -y install virtualbox
qemu -cdrom knoppix.iso -boot d -m 512
To mount a real cdrom and cd media use
qemu -cdrom /dev/cdrom -boot d -m 512
I describe here an installation for windows xp with qemu.
$dd of=xp-20gb.img bs=1024 seek=20000000 count=0
or use this command:
$qemu-img create xp-20gb.img 20G
Place windows xp cd in cdrom /dev/cdrom and write:
$qemu -boot d -cdrom /dev/cdrom -hda xp-20gb.img
On host type in some commands to create a bridge from guest os through host network: dynamically:
brctl addbr br0 ifconfig eth0 0.0.0.0 promisc brctl addif br0 eth0 dhclient br0
or static in "/etc/network/interfaces":
auto br0 iface br0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.20 bridge_ports eth0 auto eth0 iface eth0 inet manual
After you have device br0 type in these commands:
tunctl -t tap0 -u <username> brctl addif br0 tap0 ifconfig tap0 up chgrp users /dev/net/tun
Make sure that you have access rights to /dev/net/tap. Otherwise change with something like
chown root:users /dev/net/tap
which is maybe not the best solution because of security issues but it works.
and start qemu with something like:
qemu -hda xp-20gb.img -boot c -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 -m 256 -localtime
$vi .xsession xset b off
$ vi .inputrc set bell-style none
For the bell inside the vi:
$ Vi .vimrc set vb
Since edgy it is not the file inittab which is importtant for number of consoles. You have to edit the file "/etc/default/console-setup" and the files tty{1-6} under "/etc/event.d/" where the content contains lines which begin with "start ...". These lines can be commented out and you prevent these consoles to start up.
hcitool scan sdptool browse 00:80:37:25:55:96 rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device device 00:80:37:25:55:96; # RFCOMM channel for the connection channel 1; # Description of the connection comment "Nokia 6630"; } rfcomm0: 00:15:A0:4D:5A:3A channel 1 clean rfcomm connect 0 00:15:A0:4D:5A:3A 1
Das Telefon ist nun unter /dev/rfcomm0 erreichbar und kann über ein Wählprogramm angesprochen werden. Falls ein Programm auf den Zugriff über /dev/modem besteht, legt man einen symbolischen Link (mit sudo ln -s /dev/rfcomm0 /dev/modem )an.