<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Linux on Lin's Blog</title><link>https://coder.tw/en/tags/linux/</link><description>Recent content in Linux on Lin's Blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sat, 16 Jun 2018 01:12:08 +0000</lastBuildDate><atom:link href="https://coder.tw/en/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>Why Python Prints Nothing When Piped to tee</title><link>https://coder.tw/en/posts/why-python-no-output-with-tee/</link><pubDate>Sat, 16 Jun 2018 01:12:08 +0000</pubDate><guid>https://coder.tw/en/posts/why-python-no-output-with-tee/</guid><description>&lt;p&gt;Recently I wrote a Slack bot in Python. Being lazy, I just print the log messages directly and save them to a file with the tee command. That way I can see the bot&amp;rsquo;s activity in the console and keep the same information in a file. But when I combined Python&amp;rsquo;s print() with tee, I found that the log file often had no content, or messages that should have appeared showed up much later. After some research, I learned that Python&amp;rsquo;s print function checks where its output is going. If the output goes to a shell, it is written immediately. If it doesn&amp;rsquo;t, the output is stored in a buffer and only written out once the buffer is full. So when you use Python with tee, you run into this buffering problem, and the expected output doesn&amp;rsquo;t show up on the screen or in the file in time.&lt;/p&gt;</description></item><item><title>bash: warning: setlocale: LC_ALL: cannot change locale</title><link>https://coder.tw/en/posts/bash-warning-setlocale-lc_all-cannot-change-locale/</link><pubDate>Wed, 22 Feb 2017 10:01:41 +0000</pubDate><guid>https://coder.tw/en/posts/bash-warning-setlocale-lc_all-cannot-change-locale/</guid><description>&lt;p&gt;Seeing the error &amp;ldquo;-bash: warning: setlocale: LC_ALL: cannot change locale&amp;rdquo; when you log in to a remote server over SSH? You run into it because when SSH connects to a remote host, it automatically sends a copy of your local LC_* variables (the locale) to the remote host. If the server doesn&amp;rsquo;t support the locale you specified, you&amp;rsquo;ll get the error &amp;ldquo;-bash: warning: setlocale: LC_ALL: cannot change locale&amp;rdquo;!&lt;/p&gt;</description></item><item><title>When GitLab Deleted Its Database by Mistake, How Do We Keep the rm Command Under Control?</title><link>https://coder.tw/en/posts/gitlab-deleted-database-rm-command/</link><pubDate>Wed, 01 Feb 2017 23:58:28 +0000</pubDate><guid>https://coder.tw/en/posts/gitlab-deleted-database-rm-command/</guid><description>&lt;p&gt;We have all heard the story of someone accidentally deleting the root directory as a joke, but don&amp;rsquo;t think it is just a joke! I have personally seen countless friends&amp;rsquo; computers suffer this kind of disaster. Today, the engineers at GitLab (a service similar to GitHub) also demonstrated the immense power of the rm -rf command&amp;hellip; They wiped out the database on the production server&amp;hellip; I always thought this kind of disaster would never happen to me, but now even a service like GitLab, which has tens of thousands of users, has had it happen through carelessness. That made me look into how to prevent it, so let&amp;rsquo;s talk about how to keep the rm command under control!&lt;/p&gt;</description></item><item><title>Generate Large File on Linux/macOS</title><link>https://coder.tw/en/posts/generate-large-file-on-linuxmacos/</link><pubDate>Fri, 27 Jan 2017 23:59:59 +0000</pubDate><guid>https://coder.tw/en/posts/generate-large-file-on-linuxmacos/</guid><description>&lt;p&gt;Sometimes you need to generate a file of a specific size for testing network speed, disk read/write performance, or program performance. The first thing that comes to mind is probably dd, right? But when you generate files with dd, don&amp;rsquo;t you find it slow? Also, did you know that besides dd, you can also use truncate and fallocate? This post briefly explains the methods you can use to generate a large file, how to use them, and the differences between them. Note that the contents of the files generated here are meaningless.&lt;/p&gt;</description></item><item><title>How to Measure a Command's Execution Time in Terminal?</title><link>https://coder.tw/en/posts/time-command-execution-in-terminal/</link><pubDate>Fri, 27 Jan 2017 23:58:26 +0000</pubDate><guid>https://coder.tw/en/posts/time-command-execution-in-terminal/</guid><description>&lt;p&gt;Have you ever wanted to measure how long the commands you run in Terminal take? Recently, because of a work requirement, I put together a file-sorting tool out of various commands. Performance requirements were strict and it had to finish within a specified time, so I looked into the handy time command, which can measure how long a command takes to run.&lt;/p&gt;</description></item><item><title>Linux Grep Tips - Finding Lines That Contain a String</title><link>https://coder.tw/en/posts/linux-grep-tips/</link><pubDate>Fri, 20 Jan 2017 18:32:31 +0000</pubDate><guid>https://coder.tw/en/posts/linux-grep-tips/</guid><description>&lt;p&gt;On Linux, we sometimes need to quickly search a file for the &amp;ldquo;lines&amp;rdquo; that contain a keyword. For example, while reading a log, you might want to find the errors that happened at a certain time. Opening the file and scanning it line by line is not very efficient. That&amp;rsquo;s when you need grep!&lt;/p&gt;</description></item><item><title>How Can I Check That My Crontab Is Working Correctly?</title><link>https://coder.tw/en/posts/check-crontab-working/</link><pubDate>Fri, 20 Jan 2017 18:16:15 +0000</pubDate><guid>https://coder.tw/en/posts/check-crontab-working/</guid><description>&lt;p&gt;Have you ever had this problem? When you first learn crontab, you are never quite sure whether your settings are correct. After each change, you wonder whether the job will actually run the way you expect. Here I share two ways to confirm that your crontab is set up correctly!&lt;/p&gt;</description></item><item><title>How to Hook SSH Login and Send Notifications (Email or Others)</title><link>https://coder.tw/en/posts/how-to-hook-ssh-login-and-send-notification-email-or-others/</link><pubDate>Sat, 30 Jul 2016 11:01:44 +0000</pubDate><guid>https://coder.tw/en/posts/how-to-hook-ssh-login-and-send-notification-email-or-others/</guid><description>&lt;p&gt;When you first log in to Google or Facebook, they send you a notification email to improve security. I think many IT people wonder, &amp;ldquo;How can I do the same thing for SSH?&amp;rdquo; If every SSH login sends a notification to the system manager, that helps security.&lt;/p&gt;</description></item><item><title>Compiling and Installing a PHP Extension Manually (Linux)</title><link>https://coder.tw/en/posts/compile-install-php-extension-linux/</link><pubDate>Thu, 26 Jan 2012 16:53:57 +0000</pubDate><guid>https://coder.tw/en/posts/compile-install-php-extension-linux/</guid><description>&lt;p&gt;If you want to install an extension for PHP, what should you do? Many people will answer Pecl. That is indeed a very convenient way to install extensions. But what if your server does not have Pecl? And what if, for some reason, you cannot install Pecl? Then you have no choice but to compile and install the extension manually~ This post shows you how to manually compile a PHP extension on Linux.&lt;/p&gt;</description></item><item><title>How to Manually Install Python on Linux Without Breaking yum</title><link>https://coder.tw/en/posts/linux-install-python-manually-keep-yum/</link><pubDate>Fri, 19 Aug 2011 08:00:45 +0000</pubDate><guid>https://coder.tw/en/posts/linux-install-python-manually-keep-yum/</guid><description>&lt;p&gt;I previously wrote a program that automatically backs up important data on Linux and uploads it to Google Storage. It was written in Python 2.7, but the Python built into Linux is 2.4, and even if you upgrade with yum, the newest version it gives you is 2.4. So if you want a newer version of Python, you have to compile it yourself. Below, I&amp;rsquo;ll use Python 3.2 as the example.&lt;/p&gt;</description></item><item><title>Some Tricks You Probably Didn't Know That Make Using Your Computer Faster!</title><link>https://coder.tw/en/posts/pc-operation-speed-tips/</link><pubDate>Sat, 21 May 2011 01:26:16 +0000</pubDate><guid>https://coder.tw/en/posts/pc-operation-speed-tips/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/05/201105210125.jpg"&gt;&lt;img class="size-large wp-image-5106 aligncenter" title="201105210125" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/05/201105210125-520x390.jpg" alt="" width="520" height="390" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Actually, I first learned these tricks while studying vi, a plain-text editor under Linux. Later, when I tried them in other text editors (basically anywhere you can type text~), I found they worked the same way. These little tricks can speed up how quickly you process documents a lot. Also, I&amp;rsquo;ve recently been preparing for the TQC Chinese-English typing test, and practicing these tricks has helped my typing to some extent.&lt;/p&gt;</description></item><item><title>[Linux] How to Change a User Password (Also for Changing the SSH Password on iOS)</title><link>https://coder.tw/en/posts/linux-change-user-password/</link><pubDate>Fri, 18 Mar 2011 15:59:06 +0000</pubDate><guid>https://coder.tw/en/posts/linux-change-user-password/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/03/2011-03-18_160128.jpg"&gt;&lt;img class="size-large wp-image-4913 aligncenter" title="2011-03-18_160128" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/03/2011-03-18_160128-520x395.jpg" alt="" width="520" height="395" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On Linux systems, for security reasons, every account must have a password. A user must enter the correct password to log in to the system. This article shows you how to change account passwords when you manage a Linux host or a VPS. The same method also applies to jailbroken iPads and iPhones and other iOS devices. iOS&amp;rsquo;s default password is &amp;ldquo;alpine,&amp;rdquo; so if you never change it and your iOS device is jailbroken, it could be attacked.&lt;/p&gt;
&lt;h2&gt;</description></item><item><title>Ubuntu 10.10 Installation Guide (New Installer Interface)</title><link>https://coder.tw/en/posts/ubuntu-10-10-shotwell-fast-boot/</link><pubDate>Fri, 26 Nov 2010 22:54:10 +0000</pubDate><guid>https://coder.tw/en/posts/ubuntu-10-10-shotwell-fast-boot/</guid><description>&lt;p style="text-align: center;"&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2010/11/2010-11-13-19-21-56.jpg"&gt;&lt;img class="alignnone size-large wp-image-4024" title="2010-11-13-19-21-56" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2010/11/2010-11-13-19-21-56-520x292.jpg" alt="" width="520" height="292" /&gt;&lt;/a&gt;&lt;/p&gt;
This &lt;strong&gt;&lt;a href="http://www.ubuntu-tw.org/"&gt;ubuntu 10.10&lt;/a&gt;&lt;/strong&gt; update doesn't add many new features. It mainly fixes some problems from the earlier 10.4 release, and it replaces the photo manager with Shotwell. Apart from that, I didn't notice any added features. I also noticed that the installer interface has changed at some point, so I'm covering installation again in this post. What impressed me most is that Ubuntu 10.10 automatically downloads the language packs and the programs you need during installation, so you don't have to wait to download them after the install. The downside is that installation takes much longer.
&lt;h2&gt;</description></item><item><title>Ubuntu 9.04 Review and Installation Guide</title><link>https://coder.tw/en/posts/ubuntu-9-04-review/</link><pubDate>Wed, 27 May 2009 19:49:14 +0000</pubDate><guid>https://coder.tw/en/posts/ubuntu-9-04-review/</guid><description>&lt;p&gt;Ubuntu 9.04 looks like this update is aimed squarely at Windows 7. Ubuntu was updated not long after Windows 7 came out, and many of its features are very similar to Windows 7, maybe even better!! If not for the small number of programs that support Ubuntu, it might be the most famous operating system by now~~&lt;/p&gt;
&lt;p&gt;A quick introduction to Ubuntu: it&amp;rsquo;s a Linux operating system, which means its source code is public, so you can modify its contents yourself. It&amp;rsquo;s also free, and its stability far exceeds the Windows family. On Ubuntu, seeing a crash even once is rare XD However, few programs on the market support Ubuntu, especially games. There are almost no games that support Ubuntu, so Ubuntu hasn&amp;rsquo;t been able to attract a huge user base like Windows does. Also, Ubuntu releases a new version about every six months, so its updates come quickly. And this Ubuntu 9.0.4 release adds a rather attractive interface that can compete with W7!!&lt;/p&gt;
&lt;p&gt;Note: Thanks to Kgame for the correction. In fact, Ubuntu&amp;rsquo;s visual effects come from installing GNOME, not from the base system.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Ubuntu Features&lt;/strong&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Free&lt;/li&gt;
&lt;li&gt;Multiple languages (including Traditional Chinese)&lt;/li&gt;
&lt;li&gt;A new version every 6 months&lt;/li&gt;
&lt;li&gt;Includes common free software (OpenOffice, etc.)&lt;/li&gt;
&lt;li&gt;Supports 64-bit computers&lt;/li&gt;
&lt;li&gt;Live mode (just burn it to a CD and you can use it without installing)&lt;/li&gt;
&lt;li&gt;Four built-in virtual desktops&lt;/li&gt;
&lt;li&gt;An interface that rivals W7&lt;/li&gt;
&lt;/ol&gt;
Official website &lt;a href="http://www.ubuntu-tw.org/"&gt;http://www.ubuntu-tw.org/&lt;/a&gt;
&lt;p&gt;Download page: &lt;a href="http://www.ubuntu-tw.org/modules/tinyd0/index.php?id=7"&gt;&lt;a href="http://www.ubuntu-tw.org/modules/tinyd0/index.php?id=7"&gt;http://www.ubuntu-tw.org/modules/tinyd0/index.php?id=7&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>