NetworkManager usually puts “127.0.1.1” in /etc/resolv.conf
. To get currently used DNS servers, type:
% nmcli d show | grep DNS
IP4.DNS[1]: 10.1.2.3
IP4.DNS[2]: 10.2.3.4
The work is always in progress.
NetworkManager usually puts “127.0.1.1” in /etc/resolv.conf
. To get currently used DNS servers, type:
% nmcli d show | grep DNS
IP4.DNS[1]: 10.1.2.3
IP4.DNS[2]: 10.2.3.4
Instead of using Open link from context menu, you can click the link while holding Control key.
In addition to searching forwards (/<i>pattern</i>
), you can search backwards: ?<i>pattern</i>
To summarise syscalls by time or count, use strace -c
. To include child processed, add -f
switch. For example:
λ strace -cf git status
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000008 0 247 24 lstat
0.00 0.000000 0 48 read
0.00 0.000000 0 3 write
... list goes on ...
When logging on multiple machines with synchronized ~/.bashrc / ~/.zshrc you probably don’t want to set PS1 on each machine separately. Solution based on hostname will be handy.
To derive user@hostname
(or any other host-identifying command) into uniformly-distributed colours, use:
_host_colour=$(echo $(whoami)@$(hostname -f) | sum | awk "{print $1 % 256 }")
GNU tool sum
generates simple, short checksum which are then shortened down to 256 (the default Xterm colour count).
Now add the variable to your PS1:
# Bash
export PS1="[33[38;5;${_host_colour}m]u@h[33[0m] % "
# Zsh (requires module colors)
export PS1="%F{${_host_colour}}%n@%m%f %% "
Protip: If you want to change colour per-host, just set variable _host_colour
. You can do it even after PS1 was set.