在 Linux 终端中开火车
sl

> 
> 使用 sl 命令，你可以让自己驾驶火车，带来一个有趣的命令行体验。
> 
> 
> 


![](/data/attachment/album/201812/17/214157u334qqdckk3yxkaq.png)


现在是 12 月，每个 Linux 终端用户都值得这一年的奖励。因此，我们将为你带来一个 Linux 命令行玩具的日历。什么是命令行玩具？它可能是一个游戏、一个小的无意义的打发时间的东西，或者为你在终端带来快乐的东西。


今天的 Linux 命令行玩具来自 Opensource.com 社区版主 [Ben Cotton](https://opensource.com/users/bcotton) 的建议。Ben 建议 `sl`，它是<ruby> 蒸汽机车 <rt>  steam locomotive </rt></ruby>的简称。


而对于 Linux `ls` 命令来说，`sl` 也是一个常见的拼写错误，这并不是巧合（LCTT 译注：意即 `sl` 是专门用来设计提醒 `ls` 打错的）。想要不再打错吗？尝试安装 `sl`。它可能已经在默认仓库中打包。对我而言，在 Fedora 中，这意味着安装起来很简单：



```
$ sudo dnf install sl -y
```

现在，只需键入 `sl` 即可测试。


![](/data/attachment/album/201812/17/214231ztqw6nzrf85p8pqw.gif)


你可能会像我一样注意到，`Ctrl+C` 不会让你的火车脱轨，所以你必须等待整列火车通过。这会让你知道打错了 `ls`！


想查看 `sl` 源码？它已经在[在 GitHub 上](https://github.com/mtoyoda/sl)。


`sl` 也是分享我个人关于开源许可证的见解的绝佳机会。虽然它的[许可证](https://github.com/mtoyoda/sl/blob/master/LICENSE)“足够开源”能够打包到我的发行版，但技术上而言，它并不是 [OSI 批准](https://opensource.org/licenses)的许可证。在其版权行之后，许可证的内容很简单：



> 
> 每个人都可以在这个程序上做任何事情，包括复制，修改和改进，除非你试图假装你写了它。
> 
> 
> 即，上述版权声明必须出现在所有副本中。
> 
> 
> 作者对本软件不承担任何责任。
> 
> 
> 


遗憾的是，当你选择未经 OSI 批准的许可证时，你可能会意外地为你的用户带来额外的工作，因为他们必须要弄清楚你的许可证是否适用于他们的情况。他们的公司政策是否允许他们做贡献？甚至他们可以合法地使用该程序吗？许可证是否与他们希望与之集成的其他程序的许可证相匹配？


除非你是律师（也许，即使你是律师），否则在非标准许可证范围内选择可能会很棘手。因此，如果你仍在寻找新年的方案，为什么不把仅 OSI 批准的许可证作为你 2019 年新项目的选择呢。


这并不是对作者的不尊重。`sl` 仍然是一个很棒的小命令行玩具。


你有一个你认为我应该介绍的最喜欢的命令行玩具吗？这个系列的日历大部分已经完成，但我还剩下几个空余。请在下面的评论中告诉我，我会了解一下。如果有空间，我会尝试包含它。如果没有，但我得到了一些好的投稿，我会在最后做一些荣誉介绍。


了解昨天的玩具，[在 Linux 命令行中装饰字符](https://opensource.com/article/18/12/linux-toy-boxes)，还有记得明天再来！




---


via: <https://opensource.com/article/18/12/linux-toy-sl>


作者：[Jason Baker](https://opensource.com/users/jason-baker) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
It's December, and every Linux terminal user deserves a reward just for making through the year. So we're bringing you a sort of advent calendar of Linux command-line toys. What's a command-line toy? It might be a game, a pointless little time waster, or just something to bring you joy at the terminal.


Today's Linux command-line toy is a suggestion from Opensource.com community moderator [Ben Cotton](https://opensource.com/users/bcotton). Ben suggested **sl**, which is short for *steam** locomotive*.

It's also, conveniently and not coincidentally, a common typo for the Linux **ls** command. Want to stop mistyping ls? Try installing **sl**. It's probably packaged for your default repos. For me, in Fedora, that means it was as simple to install as:

`$ sudo dnf install sl`


Now, just type **sl** to try it out.

![Animation of sl Animation of sl](https://opensource.com/sites/default/files/uploads/linux-toy-sl-animated.gif)

You may notice, as I did, that **Ctrl+C** doesn't derail your train, so you have to wait for the entire train to pass. That'll teach you to mistype **ls**!

Want to check out the source to **sl**? It's over [on GitHub](https://github.com/mtoyoda/sl).

**sl** is also a great opportunity to share a personal PSA about open source licensing. While its [license](https://github.com/mtoyoda/sl/blob/master/LICENSE) was "open source enough" to be packaged for my distribution, it's not technically an [OSI-approved](https://opensource.org/licenses) license. After the copyright line, the license reads simply:

```
Everyone is permitted to do anything on this program including copying,
modifying, and improving, unless you try to pretend that you wrote it.
i.e., the above copyright notice has to appear in all copies.
THE AUTHOR DISCLAIMS ANY RESPONSIBILITY WITH REGARD TO THIS SOFTWARE.
```


Unfortunately, when you chose a license that's not OSI-approved, you may accidentally be creating extra work for your users, as they must figure out whether your license will work for their situation. Do their corporate policies allow them to contribute? Can they even legally use the program? Does the license mesh with the license of another program they wish to integrate with it?

Unless you're a lawyer (and perhaps, even if you are), navigating the space of non-standard licenses can be tricky. So if you're still looking for a New Year's Resolution, why not resolve to choose only OSI-approved licenses for any new projects you start in 2019.

No disrespect to the creator, though. **sl** is still a great little command-line toy.

Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.

Check out yesterday's toy, [Box yourself in on the Linux command line](https://opensource.com/article/18/12/linux-toy-boxes), and check back tomorrow for another!

## 3 Comments