Tag Archives: ubuntu

bash inverse wildcards

If you want to ls all BUT the .sh files:

ls !(*.sh)


tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls *.sh
random_file-clean.sh  random_file_generator.sh  random_file_spread.sh
tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls !(*.sh)
file4ShdNk  filea6uHLm  fileB4sRgx  filecdQQzj  fileLYvbHv  fileo4TKHj  fileoKaCVj  fileSxbv0v  fileTlphlz  fileYLJ43w
tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls
file4ShdNk  fileB4sRgx  fileLYvbHv  fileoKaCVj  fileTlphlz  random_file-clean.sh      random_file_spread.sh
filea6uHLm  filecdQQzj  fileo4TKHj  fileSxbv0v  fileYLJ43w  random_file_generator.sh

set vim as default editor

update-alternatives --config editor
There are 3 choices for the alternative editor (providing /usr/bin/editor).

Selection Path Priority Status
* 0 /bin/nano 40 auto mode
1 /bin/nano 40 manual mode
2 /usr/bin/vim.basic 30 manual mode
3 /usr/bin/vim.tiny 10 manual mode

how to timeout a process in the shell

tatico@tortuguita:~$ timeout -s SIGKILL 5 sleep 10
or better:
tatico@tortuguita:~$ time timeout -s SIGKILL 5 sleep 10

usefull with tcpdump, tail -f and all stuff that could stay waiting forever.

bmc4321 with kernel 3.2 on macbook 4,1 — debian or others

I’ve managed to make use mi wifi on a macbook with debian on kernel 3.2.0

    • mkdir wirelessdriver
      cd wirelessdriver/
      mv -vi ~/Downloads/hybrid-portsrc_x86_32-v5_100_82_112.tar.gz .
      tar zxvf hybrid-portsrc_x86_32-v5_100_82_112.tar.gz

  • root@tortuguita:/home/tatico/wirelessdriver# lspci -v | grep Broadcom
    02:00.0 Network controller: Broadcom Corporation BCM4321 802.11a/b/g/n (rev 03)

    500 make -C /lib/modules/3.2.0-2-486/build M=`pwd`
    501 ls
    502 ls
    503 vim src/wl/sys/wl_linux.c +388
    504 make -C /lib/modules/3.2.0-2-486/build M=`pwd`
    505 ls
    506 lsmod | grep ieee
    507 insmod wl.ko
    508 ls -l
    509 modinfo wl.ko
    510 modprobe wl.ko
    511 insmod wl.ko
    512 modprobe lib80211
    513 insmod wl.ko
    514 ifconfig

    I’ve add this to my /etc/rc.local

    modprobe lib80211
    insmod /home/tatico/wirelessdriver/wl.ko

    Source: in french

    resuming ssh transfers with rsync

    how to send and/or resume:

    rsync --partial --progress --rsh=ssh tarball_with_legal-files.tar.gz root@example.net:/mnt/directory/ --bwlimit=KBPS

    –partial: will resume files already present on remote server
    –progress: show progress bar
    –rsh: remote shell
    –bwlimit: I/O limit on local, this will impact the net bandwidth used.

    installed version for a package in debian

    # installed_version.sh
    # written by f varas, with lots of love and awk, which are basically the same.
    # how it works:
    # this script will tell you the _installed_ version of the
    # package name you pass as argument.
    if [ "x$1" != "x" ]
    then dpkg -l | grep "^ii.*$1" | awk '{ printf "%-35s %s\n", $2 , $3 }'
    else echo "usage: version_installed.sh "

    booting the debian netinst for ARM

    download debian netinstall iso for ARM

    dpkg -x linux-image-2.6.32-5-versatile_2.6.32-38_armel.deb kernel

    qemu-img create -f qcow2 debianarm.qcow2 4G

    initrd from wheezy:

    dpkg -x
    qemu-system-arm -m 256 -M versatilepb -hda debianarm.qcow2 -kernel kernel/boot/vmlinuz-2.6.32-5-versatile -append "root=/dev/ram" -cpu arm926 -initrd kernel/boot/initrd.gz