<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>linux Archives - Tom Barbette</title>
	<atom:link href="https://perso.uclouvain.be/tom.barbette/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://perso.uclouvain.be/tom.barbette/tag/linux/</link>
	<description></description>
	<lastBuildDate>Thu, 28 Apr 2022 07:21:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2022/04/cropped-logo-uclouvain-2021-barbette-32x32.png</url>
	<title>linux Archives - Tom Barbette</title>
	<link>https://perso.uclouvain.be/tom.barbette/tag/linux/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>VOO in bridge mode with IPv6 (optional: and prefix delegation!)</title>
		<link>https://perso.uclouvain.be/tom.barbette/voo-in-bridge-mode-with-ipv6-optional-and-prefix-delegation/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Wed, 27 Apr 2022 17:21:00 +0000</pubDate>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[voo]]></category>
		<guid isPermaLink="false">https://www.tombarbette.be/?p=1004</guid>

					<description><![CDATA[<p>Tutorial on configuring a Linux box to do IPv6 prefix delegation from a VOO modem in bridge mode</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/voo-in-bridge-mode-with-ipv6-optional-and-prefix-delegation/">VOO in bridge mode with IPv6 (optional: and prefix delegation!)</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Despite old threads that can be seen on VOO&#8217;s forum, VOO do not seem to use SLAAC in bridge mode (anymore?), but DHCPv6. Also VOO only gives a /64 prefix so you can&#8217;t do internal subnets <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f641.png" alt="🙁" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p><strong>Important:</strong> my outgoing (WAN) interface directly connected to the VOO modem in bridge mode is <em>enx000ec6ec03b3 </em>. My internal LAN interface is <em>br0 </em>(it&#8217;s a bridge between my actual eth0 LAN interface and a WiFi access point using hostapd, but that&#8217;s for another day).</p>



<p>This tutorial assumes Ubuntu 18.04:</p>



<p>sudo apt install wide-dhcpv6-client</p>



<p>sudo vi /etc/wide-dhcpv6/dhcp6c.conf</p>



<pre class="wp-block-code"><code>interface enx000ec6ec03b3 {
  send ia-na 1;
  send ia-pd 1;
  request domain-name-servers;
  request domain-name;
  script "/etc/wide-dhcpv6/dhcp6c-script";
};

# Only for prefix delegation
id-assoc pd 1 {
  prefix-interface br0 { #internal facing interface (LAN)
    sla-id 0; # subnet. Combined with ia-pd to configure the subnet for this interface.
    ifid 1; #IP address "postfix". if not set it will use EUI-64 address of the interface. Combined with SLA-ID'd prefix to create full IP address of interface.
    sla-len 0; # Number of prefix bits assigned. Sadly this is 0 with voo... 
    };
  };

  id-assoc na 1 {
  # id-assoc for eth1
};</code></pre>



<p>sudo vi /etc/default/wide-dhcpv6-client</p>



<pre class="wp-block-code"><code>INTERFACES="enx000ec6ec03b3"</code></pre>



<p>sudo service wide-dhcpv6-client restart</p>



<p>At this point you should get an IPv6 address:</p>



<pre class="wp-block-code"><code>enx000ec6ec03b3: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 109.89.XXX  netmask 255.255.255.0  broadcast 109.89.XXXX
        inet6 2a02:2788:XXXXXXXXX:8458  prefixlen 128  scopeid 0x0&lt;global&gt;
        inet6 fe80::20e:c6ff:feec:3b3  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 00:0e:c6:ec:03:b3  txqueuelen 1000  (Ethernet)
        RX packets 1358557038  bytes 1701875645905 (1.7 TB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 648168501  bytes 176987273193 (176.9 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</code></pre>



<h2 class="wp-block-heading">Enable prefix delegation</h2>



<p>Actually enable the prefix delegation with radvd:</p>



<p>sudo apt-get install radvd</p>



<p>sudo vi /etc/radvd.conf</p>



<pre class="wp-block-code"><code>interface br0 # LAN interface
{
  AdvManagedFlag off; # no DHCPv6 server here.
  AdvOtherConfigFlag off; # not even for options.
  AdvSendAdvert on;
  AdvDefaultPreference high;
  AdvLinkMTU 1280;
  prefix ::/64 #pick one non-link-local prefix assigned to the interface and start advertising it
  {
    AdvOnLink on;
    AdvAutonomous on;
  };
};</code></pre>



<p>sudo service radvd restart</p>



<p></p>



<p><em>Some configuration is taken and adapted from https://www.ipcalypse.ca/?p=204 </em></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/voo-in-bridge-mode-with-ipv6-optional-and-prefix-delegation/">VOO in bridge mode with IPv6 (optional: and prefix delegation!)</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Dynamic DNS with OVH</title>
		<link>https://perso.uclouvain.be/tom.barbette/dynamic-dns-with-ovh/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Wed, 15 Jan 2020 09:25:40 +0000</pubDate>
				<category><![CDATA[Server management]]></category>
		<category><![CDATA[ddclient]]></category>
		<category><![CDATA[dynhost]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ovh]]></category>
		<guid isPermaLink="false">https://www.tombarbette.be/?p=885</guid>

					<description><![CDATA[<p>It may not be a clear thing, but OVH allows to have your own Dynamic DNS if you rent a domain name, surely a better thing than the weird paid website from dyndns.org. I will explain how to handle the update with Linux using ddclient. On the manager Connect to https://www.ovh.com/manager/web/#/configuration/domain/ , select your domain &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/dynamic-dns-with-ovh/" class="more-link">Continue reading<span class="screen-reader-text"> "Dynamic DNS with OVH"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/dynamic-dns-with-ovh/">Dynamic DNS with OVH</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>It may not be a clear thing, but OVH allows to have your own Dynamic DNS if you rent a domain name, surely a better thing than the weird paid website from dyndns.org. I will explain how to handle the update with Linux using ddclient.</p>



<h2 class="wp-block-heading">On the manager</h2>



<p>Connect to  <a href="https://www.ovh.com/manager/web/#/configuration/domain/">https://www.ovh.com/manager/web/#/configuration/domain/</a> , select your domain name, and create a new dynhost with the button on the right.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="340" src="https://www.tombarbette.be/wp-content/uploads/2020/01/image-1024x340.png" alt="" class="wp-image-886" srcset="https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-1024x340.png 1024w, https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-300x100.png 300w, https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-768x255.png 768w, https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image.png 1053w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>Enter a sub-domain name such as &#8220;mydyn&#8221; (.tombarbette.be), and add the actual IP for now, or just 8.8.8.8 for the time being.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="591" height="657" src="https://www.tombarbette.be/wp-content/uploads/2020/01/image-1.png" alt="" class="wp-image-887" srcset="https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-1.png 591w, https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-1-270x300.png 270w" sizes="(max-width: 591px) 100vw, 591px" /></figure>



<p>Then it is not finished, you have to create a login that will be able to update that dns entry. Select the second button to handle accesses and create a new login.  </p>



<figure class="wp-block-image size-large"><img decoding="async" width="580" height="674" src="https://www.tombarbette.be/wp-content/uploads/2020/01/image-2.png" alt="" class="wp-image-888" srcset="https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-2.png 580w, https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2020/01/image-2-258x300.png 258w" sizes="(max-width: 580px) 100vw, 580px" /><figcaption>Select a login, probably the name of the subdomain, the subdomain itself, and a password.</figcaption></figure>



<h2 class="wp-block-heading">On the server</h2>



<p>sudo apt install ddclient</p>



<p>Then edit /etc/ddclient.conf</p>



<pre class="wp-block-preformatted">protocol=dyndns2
use=web,web=checkip.dyndns.com
server=www.ovh.com
login=<strong>tombarbette.be</strong>-<strong>mydns</strong>
password='<strong>password</strong>'
<strong>mydns</strong>.tombarbette.be</pre>



<p>Just do &#8220;sudo ddclient&#8221; to update once then &#8220;sudo service ddclient restart&#8221; to get it updated automatically.</p>



<p>May this be helpful to someone, personally I just forget it all the time so I wanted to leave a post-it somewhere.</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/dynamic-dns-with-ovh/">Dynamic DNS with OVH</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Proximus BBOX 3 in bridge mode with prefix delegation on Linux</title>
		<link>https://perso.uclouvain.be/tom.barbette/proximus-bbox-3-in-bridge-mode-on-linux-ubuntudebiancentosfedora/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Fri, 09 Oct 2015 13:37:44 +0000</pubDate>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[bbox3]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pi]]></category>
		<category><![CDATA[proximus]]></category>
		<category><![CDATA[raspberry]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=519</guid>

					<description><![CDATA[<p>Using bridge mode allows you to get a public IP address on one computer (which can serve as a router) behind your modem. This allows you to know your public IP address without using a third-party service, and control more finely all your routing parameters inside your own Linux-based router (this tutorial) or a better &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/proximus-bbox-3-in-bridge-mode-on-linux-ubuntudebiancentosfedora/" class="more-link">Continue reading<span class="screen-reader-text"> "Proximus BBOX 3 in bridge mode with prefix delegation on Linux"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/proximus-bbox-3-in-bridge-mode-on-linux-ubuntudebiancentosfedora/">Proximus BBOX 3 in bridge mode with prefix delegation on Linux</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Using bridge mode allows you to get a public IP address on one computer (which can serve as a router) behind your modem. This allows you to know your public IP address without using a third-party service, and control more finely all your routing parameters inside your own Linux-based router (this tutorial) or a better router than the BBOX&#8217;s one.</p>



<p>We&#8217;ll call &#8220;the router&#8221; the device you want to use behind the modem for clarity.</p>



<p>The bridge mode of the Proximus BBOX 3 is quite interesting. You connect normally to your BBOX using DHCP and will get a locally routable address (i.e. 192.168.0.0/24), but you can use PPP over Ethernet (PPPoE) to get a virtual interface inside your router. This virtual &#8220;ppp&#8221; interface will have a public IP address, and packets will flow IN and OUT the internet through that interface.</p>



<p>Proximus allows you to therefore maintain 2 PPP connections, one established by the BBOX (also used for the TV), and the other inside your router. It also means your home gets 2 IPv4 addresses.</p>



<pre class="wp-block-verse" style="font-style:normal;font-weight:300"><em>I prefer that mode to the VOO one, where the external IP address is given by DHCP to only one host in the LAN, the first device to connect to the router using DHCP (dangerous and prone to configuration errors...). Same and independently for IPv6 using DHCPv6. While Proximus not only gives you an IPv6 address but also a /64 prefix via PPPoE to get a direct connection without using a crappy NAT to all your PCs. For IPv6, Proximus is much simpler than setting up an independent DHCPv6 client which gives back the v6 prefix to your LAN side. The second downside is that VOO must use ugly hacks to allow connection to the box as there is no "modem internal network" anymore. You can access your modem at the normally-illegal 192.168.100.1 address as this is on the "public web" space from the router perspective. Moreover, it seems that the modem stops responding to DHCP requests from time to time, losing connectivity... VOO bridge mode is definitively not good... But this may be a temporary bug. I did not observe this anymore...</em></pre>



<h2 class="wp-block-heading">The bridge/WAN part</h2>



<p>Edit <em>/etc/network/interfaces</em> to add the following lines , assuming that eth0 is the interface used to connect to your BBOX.</p>



<pre class="wp-block-code"><code>auto dsl-provider
 iface dsl-provider inet ppp
 pre-up /bin/ip link set <strong>eth0 </strong>up
 provider dsl-provider</code></pre>



<p>Install pppoe with <em>sudo apt-get install pppoe</em> on ubuntu/debian or <em>sudo yum install pppoe</em> centos/fedora</p>



<p>Then create a file named /etc/ppp/peers/dsl-provider and add the following lines :<br><code><br>
noipdefault<br>
defaultroute<br>
replacedefaultroute<br>
hide-password<br>
noauth<br>
persist<br>
mtu 1492<br>
plugin rp-pppoe.so <strong>eth0</strong><br>
user "<strong>fc0123456</strong>@skynet"<br>
usepeerdns<br>
</code></p>



<p>Then edit the file /etc/ppp/chap-secrets and add the line :<br><code>"<strong>fc012345</strong>@skynet" * "<strong>password</strong>"</code></p>



<p>If you lost your skynet credentials (personally, I just never received them), you can change them online on MyProximus. You&#8217;ll have to reboot your modem so it receives automatically the new credentials.</p>



<p>And that&#8217;s all, you can reboot or do a <em>sudo pon dsl-provider</em> and you&#8217;ll have a new interface with a public IPv4 and a /64 IPv6.</p>



<h2 class="wp-block-heading">The router/LAN part</h2>



<p>To give connectivity in IPv4 for your hosts and use your Linux host as a router, you&#8217;ll have to do a NAT.  But you can delegate your IPv6 range and give public IPv6 addresses to all your PCs using SLAAC! Remember to also install a firewall&#8230;</p>



<p>To do so, install <em>radvd </em>and add in <em>/etc/radvd.conf </em>(if <strong>br0</strong> is the interface connected to your internal network) :</p>



<pre class="wp-block-code"><code>interface <strong>br0
</strong>
{
 AdvSendAdvert on;
 prefix ::/64
 {
   AdvOnLink on;
   AdvAutonomous on;
   AdvRouterAddr on;
 };
 RDNSS 2001:4860:4860::8888 2001:4860:4860::8844
 {
   # AdvRDNSSLifetime 3600;
 };
};</code></pre>



<p>Then do a <em>sudo radvd restart</em> and that&#8217;s it.</p>



<p>The RDNSS line gives the address of Google&#8217;s public DNS to your host. We could use Proximus&#8217; one, but I don&#8217;t have the address on hand.</p>



<p class="has-medium-font-size" style="font-style:normal;font-weight:300"><strong>Do not hesitate to contact me!</strong></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/proximus-bbox-3-in-bridge-mode-on-linux-ubuntudebiancentosfedora/">Proximus BBOX 3 in bridge mode with prefix delegation on Linux</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Installing Spotify 9.10 (may 20), 9.11 (july 2) on fedora 20 64 bits</title>
		<link>https://perso.uclouvain.be/tom.barbette/installing-spotify-9-10-may-20-on-fedora-20-64-bits/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Thu, 22 May 2014 09:36:48 +0000</pubDate>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[spotify]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=331</guid>

					<description><![CDATA[<p>UPDATE : Tested for 9.11 on July 2 &#160; Remove any old version of spotify : yum remove &#8220;*spotify*&#8221; rm -rf /usr/local/share/spotify* &#160; Remove any configuration file of the last spotify version : rm -rf /home/$USER/.config/spotify rm -rf /home/$USER/.cache/spotify &#160; Download the debian package at http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.10.17.g4129e1c.78-1_amd64.deb  http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb: wget http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb &#160; Install alien to convert the deb to &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/installing-spotify-9-10-may-20-on-fedora-20-64-bits/" class="more-link">Continue reading<span class="screen-reader-text"> "Installing Spotify 9.10 (may 20), 9.11 (july 2) on fedora 20 64 bits"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/installing-spotify-9-10-may-20-on-fedora-20-64-bits/">Installing Spotify 9.10 (may 20), 9.11 (july 2) on fedora 20 64 bits</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>UPDATE : Tested for 9.11 on July 2</p>
<p>&nbsp;</p>
<p>Remove any old version of spotify :</p>
<p>yum remove &#8220;*spotify*&#8221;</p>
<p>rm -rf /usr/local/share/spotify*</p>
<p>&nbsp;</p>
<p>Remove any configuration file of the last spotify version :</p>
<p>rm -rf /home/$USER/.config/spotify</p>
<p>rm -rf /home/$USER/.cache/spotify</p>
<p>&nbsp;</p>
<p>Download the debian package at <del>http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.10.17.g4129e1c.78-1_amd64.deb</del>  http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb:</p>
<p>wget http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb</p>
<p>&nbsp;</p>
<p>Install alien to convert the deb to RPM :</p>
<p>sudo yum install alien</p>
<p>&nbsp;</p>
<p>Convert the deb to RPM with alien :</p>
<p>fakeroot alien -r spotify-client_0.9.10.17.g4129e1c.78-1_amd64.deb</p>
<p>&nbsp;</p>
<p>Install the rpm :</p>
<p>sudo rpm -ivh &#8211;nodeps &#8211;force spotify-client-0.9.10.17.g4129e1c.78-2.x86_64.rpm</p>
<p>&nbsp;</p>
<p>You will very probably have problems of dependencies to old libraries when launching spotify, like for libssl.so.1.0.0 , libudev.so.0 and libcrypto.so.1.0.0, I made a tarball with them.</p>
<p>&nbsp;</p>
<p>Download <a href="https://www.tombarbette.be/wp-content/uploads/2014/05/oldlibs.tar.gz">oldlibs.tar</a> :</p>
<p>wget https://www.tombarbette.be/wp-content/uploads/2014/05/oldlibs.tar.gz</p>
<p>&nbsp;</p>
<p>Untar them :</p>
<p>tar -zxvf oldlibs.tar.gz</p>
<p>&nbsp;</p>
<p>Copy them to /usr/lib64 :</p>
<p>cp -rf oldlibs/* /usr/lib64/</p>
<p>&nbsp;</p>
<p>Remove the tarball :</p>
<p>rm -rf oldlibs*</p>
<p>&nbsp;</p>
<p>If you don&#8217;t have any shorcut to launch spotify, copy the desktop entry :</p>
<p>cp -rf /opt/spotify/spotify-client/spotify.desktop /usr/share/applications/</p>
<p>&nbsp;</p>
<p>If when you type &#8220;spotify&#8221; it doesn&#8217;t launch anything (and say this command is not found) :</p>
<p>sudo ln -s /opt/spotify/spotify-client/spotify /usr/bin/spotify</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/installing-spotify-9-10-may-20-on-fedora-20-64-bits/">Installing Spotify 9.10 (may 20), 9.11 (july 2) on fedora 20 64 bits</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>HDParm</title>
		<link>https://perso.uclouvain.be/tom.barbette/hdparm/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Wed, 12 Feb 2014 16:01:40 +0000</pubDate>
				<category><![CDATA[Server management]]></category>
		<category><![CDATA[hdd]]></category>
		<category><![CDATA[hdparm]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=89</guid>

					<description><![CDATA[<p>HDParm is a tool to manage your drives. The first section show you how to get informations about your drives, the second tells you how to make them sleep when they aren&#8217;t used (and so make power economy). If you&#8217;ve got a home server like me with the system on a SSD, with only your &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/hdparm/" class="more-link">Continue reading<span class="screen-reader-text"> "HDParm"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/hdparm/">HDParm</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>HDParm is a tool to manage your drives. The first section show you how to get informations about your drives, the second tells you how to make them sleep when they aren&#8217;t used (and so make power economy). If you&#8217;ve got a home server like me with the system on a SSD, with only your big files on the hard drives(s), you&#8217;ll want to do this.</p>
<p>&nbsp;</p>
<h3>Get disk informations</h3>
<p>You&#8217;ve got to use &#8220;sudo&#8221; to gain super user privilege. Your disk are in the <em>/dev/</em> folder, named <em>sd*</em> where <em>&#8220;*&#8221;</em> is a letter. To see the list of disk, one can type use &#8220;<em>ls /dev/sd[a-z]</em>&#8220;:<br />
<code>debserver % ls /dev/sd[a-z]<br />
/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde</code></p>
<p>&nbsp;</p>
<p>To display informations about one disk, you can use <em>&#8220;sudo hdparm -i&#8221;</em></p>
<p>&nbsp;</p>
<p><code>debserver % sudo hdparm -i /dev/sda<br />
/dev/sda:</code></p>
<p>Model=WDC WD20EFRX-68EUZN0, FwRev=80.00A80, SerialNo=WD-WCC4M1067803<br />
Config={ HardSect NotMFM HdSw&gt;15uSec SpinMotCtl Fixed DTR&gt;5Mbs FmtGapReq }<br />
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0<br />
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16<br />
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=3907029168<br />
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}<br />
PIO modes: pio0 pio3 pio4<br />
DMA modes: mdma0 mdma1 mdma2<br />
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6<br />
AdvancedPM=no WriteCache=enabled<br />
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7</p>
<p>* signifies the current active mode</p>
<p>&nbsp;</p>
<h3>Make a drive sleep after some time</h3>
<p>From the manual (man hdparm on the command line):</p>
<p><code>-S Set the standby (spindown) timeout for the drive. This value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means "timeouts are disabled": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.</code></p>
<p>&nbsp;</p>
<p>So &#8220;<em>sudo hdparm -I /dev/sdb | grep level</em>&#8221; will show the current spindown value, for <strong>Example</strong>:</p>
<p><code>debserver % sudo hdparm -I /dev/sdb | grep level<br />
Advanced power management level: 254</code></p>
<p>Example:</p>
<p><em>sudo hdparm -S 25 /dev/sdb = spindown after 25*5 seconds.</em></p>
<p><em>sudo hdparm -S 245 /dev/sdb = spindown after (245-240)*30 minutes.</em></p>
<p>&nbsp;</p>
<p>If you want to check the state to see if it works :</p>
<p><code>sudo watch -n 1 "hdparm -C /dev/sdb &amp;&amp; hdparm -C /dev/sdc &amp;&amp; hdparm -C /dev/sdd &amp;&amp; hdparm -C /dev/sde"</code></p>
<p>&nbsp;</p>
<p>You can use /etc/hdparm.conf to make it permanent:<br />
<code>/dev/sdb {<br />
spindown_time = 60<br />
}<br />
</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/hdparm/">HDParm</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ugly things : do not ask password for sudo</title>
		<link>https://perso.uclouvain.be/tom.barbette/ugly-things-do-not-ask-password-for-sudo/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Mon, 03 Feb 2014 10:53:37 +0000</pubDate>
				<category><![CDATA[INFO-0940 Operating Systems]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[info0940]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[ugly]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[visudo]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=155</guid>

					<description><![CDATA[<p>&#8211;> Ugly but okay in a development virtual machine Launch the command &#8220;sudo visudo&#8221; in a terminal. Add at the end : student ALL=(ALL) NOPASSWD: ALL And student will have no password prompt when using sudo</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/ugly-things-do-not-ask-password-for-sudo/">Ugly things : do not ask password for sudo</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>&#8211;> Ugly but okay in a development virtual machine</p>
<p>Launch the command &#8220;sudo visudo&#8221; in a terminal.</p>
<p>Add at the end :<br />
<code sh>student ALL=(ALL) NOPASSWD: ALL</code></p>
<p>And student will have no password prompt when using sudo</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/ugly-things-do-not-ask-password-for-sudo/">Ugly things : do not ask password for sudo</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ugly things : Autologin of console at startup</title>
		<link>https://perso.uclouvain.be/tom.barbette/ugly-things-autologin-of-console-at-startup/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Mon, 03 Feb 2014 10:51:47 +0000</pubDate>
				<category><![CDATA[INFO-0940 Operating Systems]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[info0940]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ugly]]></category>
		<category><![CDATA[unix]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=153</guid>

					<description><![CDATA[<p>→ Ugly but okay in a development virtual machine… Add &#8220;– – autologin root&#8221; at the end of /etc/init/tty1.conf It will auto-log you as root for the first console. For the others, do the same with /etc/init/tty[1-5].conf You can autolog as “student” by replacing root by student. It’s a little safer … but still ugly.</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/ugly-things-autologin-of-console-at-startup/">Ugly things : Autologin of console at startup</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>→ Ugly but okay in a development virtual machine…</p>
<p>Add &#8220;– – autologin <strong>root</strong>&#8221; at the end of /etc/init/tty1.conf</p>
<p>It will auto-log you as root for the first console. For the others, do the same with /etc/init/tty[1-5].conf</p>
<p>You can autolog as “student” by replacing <strong>root</strong> by student. It’s a little safer … but still ugly.</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/ugly-things-autologin-of-console-at-startup/">Ugly things : Autologin of console at startup</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Detecting if another user is connected on UNIX systems</title>
		<link>https://perso.uclouvain.be/tom.barbette/detecting-if-another-user-is-connected/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Tue, 14 Jan 2014 10:11:06 +0000</pubDate>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[connected]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[users]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=76</guid>

					<description><![CDATA[<p>How to detect if another user is connected to your machine or your server? You can use the command &#8220;users&#8221; to check yourself is someone is connected. But to do it automatically, you&#8217;ll have to use some pipe : [code lang=&#8221;bash&#8221;]expr length &#8220;`users &#124; sed -e &#8220;s/\($USER\&#124;\[ \]*\)//ig&#8221;`&#8221;[/code] The first thing executed by the shell &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/detecting-if-another-user-is-connected/" class="more-link">Continue reading<span class="screen-reader-text"> "Detecting if another user is connected on UNIX systems"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/detecting-if-another-user-is-connected/">Detecting if another user is connected on UNIX systems</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>How to detect if another user is connected to your machine or your server? You can use the command &#8220;users&#8221; to check yourself is someone is connected. But to do it automatically, you&#8217;ll have to use some pipe :</p>
<p>[code lang=&#8221;bash&#8221;]expr length &#8220;`users | sed -e &#8220;s/\($USER\|\[ \]*\)//ig&#8221;`&#8221;[/code]</p>
<p>The first thing executed by the shell will be the thing under french apostrophe ( ` ). Theses are for evaluation a command, and replace it by what it outputs (normally print on the screen). The command users print the list of connected users into a pipe, to sed which evaluate its command as a regular expression (-e parameter). The command is &#8220;s&#8221; for substitute, and the rest tells him to find &#8220;$USER&#8221; (replaced by the currently connected user, you) and spaces and replace them by &#8230; nothing. So this part will be an empty string if there is no other users connected than &#8220;$USER&#8221; and something not empty if there is.</p>
<p>The &#8220;expr length&#8221; return the length of a string. So this commands print 0 if there is no other user connected, and &gt;0 if there is some !</p>
<p>In a shell script to do something if yes or no&#8230;<br />
[code lang=&#8221;bash&#8221;]#!/bin/sh<br />
usersstripped=`users | sed -e &#8220;s/\(<strong>tom</strong>\|\[ \]*\)//ig&#8221;`<br />
connected=`expr length &#8220;$usersstripped&#8221;`<br />
if [ &#8220;$connected&#8221; -eq &#8220;0&#8221; ] ; then<br />
echo &#8220;No other user is connected&#8221;<br />
else<br />
echo &#8220;Other user connected !&#8221;<br />
fi[/code]</p>
<p>It is essentially the same command but done in two times, as in a shell script this command would not be evaluated correctly.</p>
<p>And if you want to put that in a cron to eg. send you a mail, you just have to type &#8220;crontab -e&#8221; and put a line like :</p>
<p>[code]* * * * * /home/tom/connected[/code]</p>
<p>To launch it every minutes. But if you do that you&#8217;d better do something like detecting a connection&#8230;</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/detecting-if-another-user-is-connected/">Detecting if another user is connected on UNIX systems</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>My .ZSHRC</title>
		<link>https://perso.uclouvain.be/tom.barbette/my-zshrc/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Sun, 05 Jan 2014 16:33:37 +0000</pubDate>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[zsh]]></category>
		<category><![CDATA[zshrc]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=65</guid>

					<description><![CDATA[<p>To gain a lot of time, you can replace the old &#8220;bash&#8221; by &#8220;zsh&#8221;, which is a very more powerful shell with autocompletion, but not only&#8230; It has a configuration file called &#8220;.zshrc&#8221; that you have to put in your home. You can try zsh by installing it and typing &#8220;zsh&#8221;, and if you&#8217;re convinced, &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/my-zshrc/" class="more-link">Continue reading<span class="screen-reader-text"> "My .ZSHRC"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/my-zshrc/">My .ZSHRC</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To gain a lot of time, you can replace the old &#8220;bash&#8221; by &#8220;zsh&#8221;, which is a very more powerful shell with autocompletion, but not only&#8230; It has a configuration file called &#8220;.zshrc&#8221; that you have to put in your home. You can try zsh by installing it and typing &#8220;zsh&#8221;, and if you&#8217;re convinced, keeping it by typing chsh and choosing /bin/zsh.</p>
<p><span style="line-height: 1.5;">You have my entire .zshrc but I choose 3 snippets that I prefer to show you the usefullness :</span></p>
<p><span style="line-height: 1.5;">As I use Fedora, Debian, and Ubuntu, I made this to type &#8220;i program&#8221; to install profram on any system, and &#8220;u&#8221; to update the system. </span></p>
<p><span style="line-height: 1.5;"><br />
</span><span style="line-height: 1.5;">[code lang=&#8221;bash&#8221;]<br />
</span>#i for install, u for update</p>
<p>if [ -e /bin/yum ]; then<br />
alias i=&#8221;sudo yum install&#8221;<br />
alias u=&#8221;sudo yum update&#8221;<br />
else<br />
alias i=&#8221;sudo apt-get install&#8221;<br />
alias u=&#8221;sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade&#8221;<br />
fi<br />
[/code]</p>
<p><span style="line-height: 1.5;">Force sudo for commands that anyway need it<br />
[code lang=&#8221;bash&#8221;]<br />
</span>alias yum=&#8221;sudo yum&#8221;<br />
alias apt-get=&#8221;sudo apt-get&#8221;<br />
alias service=&#8221;sudo service&#8221;<br />
[/code]</p>
<p>&nbsp;</p>
<p>Setting vi as default editor :<br />
[code lang=&#8221;bash&#8221;]<br />
export EDITOR=&#8221;vi&#8221;<br />
[/code]</p>
<p>&nbsp;</p>
<p>The multiples ssh shorcuts<br />
[code lang=&#8221;bash&#8221;]alias sshd=&#8221;ssh mappam.dyndns.org -X&#8221;<br />
alias sshc=&#8221;ssh itstudents.be -X -L 3129:localhost:3129&#8243;[/code]</p>
<p>I use my zshrc on multiple system and multiple environment, hence you have some tricks and multiplications like different variables for the same program in the path variable.</p>
<p>[code lang=&#8221;bash&#8221;]</p>
<p>#Using color schemes<br />
autoload -U colors &amp;&amp; colors</p>
<p>#Adding ADB to path variable<br />
export PATH=${PATH}:/usr/src/android-sdk-linux/platform-tools/:/usr/src/android-sdk-linux/tools/:/opt/android/platform-tols/</p>
<p>##################<br />
# Aliases<br />
##################<br />
#SSH shorcuts<br />
alias sshd=&#8221;ssh mappam.dyndns.org -X&#8221;<br />
alias sshc=&#8221;ssh itstudents.be -X -L 3129:localhost:3129&#8243;<br />
alias ssha=&#8221;ssh asbss.be -X&#8221;<br />
alias sshu=&#8221;ssh barbette@ms806.montefiore.ulg.ac.be -X&#8221;<br />
alias sshq=&#8221;ssh barbette@queen.run.montefiore.ulg.ac.be -X&#8221;<br />
alias scpi=&#8221;scp -i /home/tom/.ssh/id_rsa&#8221;<br />
alias scp3=&#8221;scp -P 3690 -i /home/tom/.ssh/id_rsa&#8221;<br />
alias sam=&#8221;ssh-add /home/tom/.ssh/id_rsa.montefiore&#8221;</p>
<p>#I have all my usefull scripts on my server itstudents, this alias update all scripts on a client, including this .zshrc<br />
alias us=&#8221;mkdir -p /home/tom/.scripts &amp;&amp; scpi tom@itstudents.be:/home/tom/.ssh/authorized_keys /home/tom/.ssh/authorized_keys &amp;&amp; scpi tom@itstudents.be:/home/tom/.zshrc /home/tom/.zshrc &amp;&amp; scpi -r tom@itstudents.be:/home/tom/.scripts/ /home/tom/ &amp;&amp; source /home/tom/.zshrc&#8221;</p>
<p>#Alias for these scripts&#8230;<br />
#Archiver pack a folder in tar.gz<br />
alias archiver=&#8221;/home/tom/.scripts/archiver&#8221;<br />
#Archiver7 pack a folder in a tar.7z<br />
alias archiver7=&#8221;/home/tom/.scripts/archiver7&#8243;<br />
#Update and reset permissions of an svn<br />
alias svnup=&#8221;/home/tom/.scripts/svnup&#8221;<br />
#Push an rsa key to the list of authorized keys<br />
alias pushrsa=&#8221;ssh tom@itstudents.be \&#8221;cat &#8211; &gt;&gt; /home/tom/.ssh/authorized_keys\&#8221; &lt; &#8221;</p>
<p>#Mount some local shares<br />
alias mh=&#8221;sudo mount -t nfs debserver:/home/tom /mnt/debserver-home&#8221;<br />
alias mp=&#8221;sudo mount -t nfs debserver:/pub /mnt/debserver-pub&#8221;</p>
<p>#Force sudo for some sudo-only commands like installers<br />
alias yum=&#8221;sudo yum&#8221;<br />
alias apt-get=&#8221;sudo apt-get&#8221;<br />
alias service=&#8221;sudo service&#8221;</p>
<p>#Some copy-pasted shorcut from elsewhere<br />
alias k=&#8217;tree&#8217;<br />
alias ltr=&#8217;ls -ltr&#8217;<br />
alias r=&#8217;screen -D -R&#8217;<br />
alias ls=&#8217;ls &#8211;color&#8217;<br />
alias l=&#8217;ls -lh&#8217;<br />
alias ll=&#8217;ls -la&#8217;<br />
#i for install, u for update<br />
if [ -e /bin/yum ]; then<br />
alias i=&#8221;sudo yum install&#8221;<br />
alias u=&#8221;sudo yum update&#8221;<br />
else<br />
alias i=&#8221;sudo apt-get install&#8221;<br />
alias u=&#8221;sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade&#8221;<br />
fi</p>
<p>#Some links to launch programs on my android devices<br />
alias adbf=&#8221;ard &amp;&amp; adb forward tcp:8999 tcp:8999 &amp;&amp; google-chrome http://localhost:8999 &amp;&#8221;<br />
alias agmail=&#8221;adb shell am start -a android.intent.action.MAIN -n com.google.android.gm/.ConversationListActivityGmail&#8221;<br />
alias amail=&#8221;adb shell am start -a android.intent.action.MAIN -n com.google.android.email/com.android.email.activity.EmailActivity&#8221;<br />
alias ard=&#8221;adb shell am start -a android.intent.action.MAIN -n net.xdevelop.rm/.RemoteMobile&#8221;<br />
alias rr=&#8221;sudo route del default &amp;&amp; sudo route add default gw 10.0.0.1&#8243;</p>
<p>#Wake on lan shorcuts<br />
alias wdebian=&#8221;sudo etherwake 8C:89:A5:C1:D2:8A&#8221;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p># Meta-u to chdir to the parent directory<br />
bindkey -s &#8216;\eu&#8217; &#8216;^Ucd ..; ls^M&#8217;</p>
<p>bindkey &#8216;\e[1~&#8217; beginning-of-line<br />
bindkey &#8216;\e[4~&#8217; end-of-line<br />
bindkey &#8216;\e[7~&#8217; beginning-of-line<br />
bindkey &#8216;\e[8~&#8217; end-of-line<br />
bindkey &#8216;\eOH&#8217; beginning-of-line<br />
bindkey &#8216;\eOF&#8217; end-of-line<br />
bindkey &#8216;\e[H&#8217; beginning-of-line<br />
bindkey &#8216;\e[F&#8217; end-of-line<br />
bindkey &#8216;\e[5~&#8217; beginning-of-history<br />
bindkey &#8216;\e[6~&#8217; end-of-history<br />
bindkey &#8216;\e[3~&#8217; delete-char</p>
<p>#Enable auto correct for commands<br />
setopt correct</p>
<p># Pipe the current command through less<br />
bindkey -s &#8220;\el&#8221; &#8221; 2&gt;&amp;1|less^M&#8221;<br />
zstyle &#8216;:completion:*:(all-|)files&#8217; ignored-patterns &#8216;(|*/)CVS&#8217;<br />
zstyle &#8216;:completion:*:cd:*&#8217; ignored-patterns &#8216;(*/)#CVS&#8217;</p>
<p>#Mode verbose pour cp, rm, chmod, chown et rename<br />
for c in cp rm chmod chown rename; do<br />
alias $c=&#8221;$c -v&#8221;<br />
done</p>
<p>#Pendunt une complétion affiche les points<br />
expand-or-complete-with-dots() {<br />
echo -n &#8220;\e[31m&#8230;&#8230;\e[0m&#8221;<br />
zle expand-or-complete<br />
zle redisplay<br />
}<br />
zle -N expand-or-complete-with-dots<br />
bindkey &#8220;^I&#8221; expand-or-complete-with-dots</p>
<p>setopt EXTENDED_GLOB<br />
setopt NO_BEEP<br />
export EDITOR=&#8221;vi&#8221;<br />
setopt ZLE<br />
setopt AUTO_CD</p>
<p>##################<br />
# Completion Stuff<br />
##################<br />
bindkey -M viins &#8216;\C-i&#8217; complete-word</p>
<p># Faster! (?)<br />
zstyle &#8216;:completion::complete:*&#8217; use-cache 1<br />
# generate descriptions with magic.<br />
zstyle &#8216;:completion:*&#8217; auto-description &#8216;specify: %d&#8217;</p>
<p># Don&#8217;t prompt for a huge list, page it!<br />
zstyle &#8216;:completion:*:default&#8217; list-prompt &#8216;%S%M matches%s&#8217;</p>
<p># Don&#8217;t prompt for a huge list, menu it!<br />
zstyle &#8216;:completion:*:default&#8217; menu &#8216;select=0&#8217;</p>
<p># Have the newer files last so I see them first<br />
zstyle &#8216;:completion:*&#8217; file-sort modification reverse</p>
<p># color code completion!!!! Wohoo!<br />
zstyle &#8216;:completion:*&#8217; list-colors &#8220;=(#b) #([0-9]#)*=36=31&#8243;</p>
<p>unsetopt LIST_AMBIGUOUS<br />
setopt COMPLETE_IN_WORD</p>
<p># Separate man page sections. Neat.<br />
zstyle &#8216;:completion:*:manuals&#8217; separate-sections true</p>
<p># Egomaniac!<br />
zstyle &#8216;:completion:*&#8217; list-separator &#8216;fREW&#8217;</p>
<p># complete with a menu for xwindow ids<br />
zstyle &#8216;:completion:*:windows&#8217; menu on=0<br />
zstyle &#8216;:completion:*:expand:*&#8217; tag-order all-expansions</p>
<p># more errors allowed for large words and fewer for small words<br />
zstyle &#8216;:completion:*:approximate:*&#8217; max-errors &#8216;reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )&#8217;</p>
<p># Errors format<br />
zstyle &#8216;:completion:*:corrections&#8217; format &#8216;%B%d (errors %e)%b&#8217;</p>
<p># Don&#8217;t complete stuff already on the line<br />
zstyle &#8216;:completion::*:(rm|vi):*&#8217; ignore-line true</p>
<p># Don&#8217;t complete directory we are already in (../here)<br />
zstyle &#8216;:completion:*&#8217; ignore-parents parent pwd</p>
<p>zstyle &#8216;:completion::approximate*:*&#8217; prefix-needed false</p>
<p>#}}}</p>
<p>export GREP_COLOR=31<br />
alias grep=&#8217;grep &#8211;color=auto&#8217;</p>
<p>#{{{ Prompt!<br />
colors<br />
host_color=cyan<br />
history_color=yellow<br />
user_color=green<br />
root_color=red<br />
directory_color=magenta<br />
error_color=red<br />
jobs_color=green</p>
<p>host_prompt=&#8221;%{$fg_bold[$host_color]%}%m%{$reset_color%}&#8221;<br />
jobs_prompt1=&#8221;%{$fg_bold[$jobs_color]%}(%{$reset_color%}&#8221;<br />
jobs_prompt2=&#8221;%{$fg[$jobs_color]%}%j%{$reset_color%}&#8221;<br />
jobs_prompt3=&#8221;%{$fg_bold[$jobs_color]%})%{$reset_color%}&#8221;<br />
jobs_total=&#8221;%(1j.${jobs_prompt1}${jobs_prompt2}${jobs_prompt3} .)&#8221;<br />
history_prompt1=&#8221;%{$fg_bold[$history_color]%}[%{$reset_color%}&#8221;<br />
history_prompt2=&#8221;%{$fg[$history_color]%}%h%{$reset_color%}&#8221;<br />
history_prompt3=&#8221;%{$fg_bold[$history_color]%}]%{$reset_color%}&#8221;<br />
history_total=&#8221;${history_prompt1}${history_prompt2}${history_prompt3}&#8221;<br />
error_prompt1=&#8221;%{$fg_bold[$error_color]%}&lt;%{$reset_color%}&#8221;<br />
error_prompt2=&#8221;%{$fg[$error_color]%}%?%{$reset_color%}&#8221;<br />
error_prompt3=&#8221;%{$fg_bold[$error_color]%}&gt;%{$reset_color%}&#8221;<br />
error_total=&#8221;%(?..${error_prompt1}${error_prompt2}${error_prompt3} )&#8221;</p>
<p>case &#8220;$TERM&#8221; in<br />
(screen)<br />
function precmd() { print -Pn &#8220;\033]0;S $TTY:t{%100&lt;&#8230;&lt;%~%&lt;&lt;}\007&#8243; }<br />
;;<br />
(xterm)<br />
directory_prompt=&#8221;%{$fg[$directory_color]%}%~%{$reset_color%} &#8221;<br />
;;<br />
(*)<br />
directory_prompt=&#8221;%{$fg[$directory_color]%}%~%{$reset_color%} &#8221;<br />
;;<br />
esac</p>
<p>if [[ $USER == root ]]; then<br />
post_prompt=&#8221;%{$fg_bold[$root_color]%}%#%{$reset_color%}&#8221;<br />
else<br />
post_prompt=&#8221;%{$fg_bold[$user_color]%}%#%{$reset_color%}&#8221;<br />
fi<br />
fg_light_gray=$&#8217;%{\e[0;34m%}&#8217;<br />
PS1=&#8221;${host_prompt} ${jobs_total}${history_total} ${error_total}${post_prompt} &#8221;<br />
RPROMPT=&#8221;%{$fg_bold[$user_color]%}&lt;%{$reset_color%} ${directory_prompt}${fg_light_gray}[%*]%{$reset_color%}&#8221;<br />
#}}}<br />
#Type f to flush the console to history file<br />
alias f=&#8221;fc -W&#8221;</p>
<p>HISTSIZE=10000<br />
SAVEHIST=10000<br />
HISTFILE=~/.history</p>
<p>setopt LIST_PACKED</p>
<p>#Append to history file instead of re-writing<br />
setopt APPEND_HISTORY</p>
<p>#To share history between terminal, not what I want as I always have multiple terminals like one for generating packet, the other to receive them<br />
#setopt SHARE_HISTORY</p>
<p>#Remove blanks<br />
setopt hist_reduce_blanks<br />
#Remove duplicates<br />
setopt hist_ignore_all_dups<br />
#Do not store commands in history starting with white space<br />
setopt hist_ignore_space</p>
<p>#Init<br />
autoload -U compinit promptinit zcalc zsh-mime-setup<br />
compinit<br />
promptinit<br />
zsh-mime-setup[/code]</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/my-zshrc/">My .ZSHRC</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
