Tag: Linux


Speedtest for Hackers

If you want to do an ongoing speedtest with graphs for up- and download, forget about the web-based tools like speedtest.net and fast.com – those are nice if you are on mobile. Yet, when you are on a *nix machine, there’s better tooling in your Shell.

Speedtest Download

First, fire up a Terminal and start `nload` to view network traffic. If you are on macOS, you can also use the graphical tool ‘activity monitor`.

Then, in a second Terminal, start a permanent upload or download with the following commands:

Upload


ssh lafo@dublin.zhaw.ch "cat /dev/urandom" > /dev/null

Download

cat /dev/urandom| ssh lafo@dublin.zhaw.ch "cat > /dev/null"

Note that depending on your `ssh` configuration, you might need to disable compression on the client or server side.

Comment » | articles

Login Hack in X (Linux)

Einen Login Manager habe ich nicht in Debian. Debian laeuft bei mir in einer VM und dort quasi immer. Wenn ich die VM nicht brauche kommt sie in den Suspend. Ich melde mich also ueber den Mac am System an.

Mit folgendem Hack erreiche ich ein fuer mich optimales Login:

In meiner /etc/inittab (das init System in Linux definiert Runlevels und in der inittab definiert die Prozesse, welche beim Start der Runlevels gestartet werden):

1:2345:respawn:/bin/login -f munen tty1 /dev/tty1 2>&1

Normalerweise sollte da ein Login stehen, etwa getty fuer Konsolen Login. Mein Hack loggt automatisch den User `munen` ein.

In der /etc/passwd steht welche Shell der User `munen` moechte, das ist bei mir die zsh. Diese wird beim Login des Users also gestartet. Eine der Konfigurationsdateien, welche die ZSH liesst ist die ~/.zprofile. In dieser steht Folgendes:

if [[ -z "$DISPLAY" && $(tty) = /dev/tty1 ]]; then
exec startx
fi

Das bedeutet, dass wenn die ZSH startet geprueft wird, ob ich auf den tty1 eingeloggt bin (siehe inittab). Falls ja, wird X via startx gestartet. Das ist ein Shell Script was im xinit Paket von Debian mitkommt. Dieses startet X ohne Login Manager.

Et voilà! Linux startet mit graphischer Oberflaeche ohne nur eine Passwort Eingabe! Ich betone nochmal, das mache ich, da ich den Mac _immer_ locke wenn ich ihn verlasse und mein Linux ausschliesslich als VM im Mac laeuft.

Ist ein Hack, aber auch ein gutes Beispiel dafuer dass man mit einem Linux machen kann was man mag – wenn man es denn will^^

Comment » | articles

Make Apple CMD/Command key an additional CTRL/Control key in X11

If you want to use shortcuts in Linux/X11 as you are used to in OSX, you can configure X11 to use the CMD key as an additional CTRL key. Your muscle memory of CMD+c, CMD+s, CMD+v will not betray you anymore, then.

Since Linux is highly configurable, we can just tamper with the keymap.

1. Create a file ~/.Xmodmap

! clear CMD of it's regular task, whatever that might be
clear mod4

! configure CTRL and CMD to act as left Control
keycode 133 = Control_L NoSymbol Control_L
keycode 37 = Control_L NoSymbol Control_L

! use CTRL and CMD to act as left Control
add control = Control_L

Note: This works for my Macbook Pro (early 2011) with US layout. Your machine may use different keycodes. You can find out easily which is your CMD key, though. Just look for “Super_L” in your current keymap.

➜  ~  xmodmap -pke | grep Super_L
keycode 133 = Super_L NoSymbol Super_L

2. Load keymap patch

xmodmap ~/.Xmodmap

3. Autoloading

When this works for you (try copy/pasting/saving), then make sure to autoload .Xmodmap on start of X11. I do that using my window manager I3, but you also might add something similar to .xinitrc or .xsession

echo "exec xmodmap ~/.Xmodmap &" >> .i3/config

Comment » | articles

« Previous Entries