蓦然回首,那些命令都在灯火阑珊处
来源:互联网 发布:desmume mac 编辑:程序博客网 时间:2024/05/01 13:16
从StackExchange中linux&unix发现一些好玩的问题,把他们先记录下来。
1. A shell tool to “tablify” input data
A long time ago I remember using a command that makes its input into a nicely formatted table.
For example, for this input,
apple 1 100
orange 20 19
pineapple 1000 87
avocado 4 30
The output will be similar to this:
apple 1 100
orange 20 19
pineapple 1000 87
avocado 4 30
I'd like to know the name of this tool.
Answer:
column -t
$ column -t <<END
> apple 1 100
> orange 20 19
> pineapple 1000 87
> avocado 4 30
> END
apple 1 100
orange 20 19
pineapple 1000 87
avocado 4 30
2. I have a lot of commands I routinely need to execute, often with the slightest variation.
Right now I'm storing them all in .bash_history and use CTRL-R to access them, but I wonder if there's a better way. What I'm looking for:
Easy to add a new command
Easy to search and re-execute a wanted command
Avoid unwanted commands in suggestions
Unfortunately, bash_history is not so strong on the third demand: if I do a few cd and ls, it fills the history file quickly. I have recently learned about HIST_SIZE and that you can configure the history to avoid duplicates or certain commands, but before configuring all that, I wanted to make sure it is the best way.
Answer:
A. Another tip: I sometimes use comments to bookmark/tag a command:
my_command #bookmark
then:
[ctrl-r]#bookmark
history-search-backward,
history-search-forward
(be aware they are different from the usual reverse-search-history, forward-search-history, tied to Ctrl-R, Ctrl-S).
I have these commands associated to Ctrl-Up and Ctrl-Down putting the following lines into ~/.inputrc:
"\e[1;5A": history-search-backward
"\e[1;5B": history-search-forward
How they work: write few chars of the beginning of the command, press Ctrl-Up and the next older command starting with that prefix will be shown, press again to see the next, and so on. When you are satisfied, after possibly modifying the command, press Enter to execute.
- 蓦然回首,那些命令都在灯火阑珊处
- 蓦然回首,机会就在灯火阑珊处
- 【年度总结】蓦然回首,我在灯火阑珊处
- 蓦然回首 灯火阑珊
- 众里寻他千百度,蓦然回首,那人却在灯火阑珊处
- HUDSON邮件模板问题 <众里寻他千百度,蓦然回首,那‘人’却在灯火阑珊处>
- 奋斗吧,程序员——第十三章 蓦然回首,那人却在灯火阑珊处
- 转载:HUDSON邮件模板问题 <众里寻他千百度,蓦然回首,那‘人’却在灯火阑珊处>
- 蓦然回首,灯火阑珊——自考总结
- 我等你,在灯火阑珊处
- 灯火阑珊处
- 灯火阑珊处
- 灯火阑珊
- 灯火阑珊
- 灯火阑珊处——Agile
- 灯火阑珊处等你回眸
- 灯火阑珊处等你回眸
- 灯火阑珊处等你回眸
- 用java计算:1-1/3+1/5-1/7+1/9-1/11+......的前10000项之和
- 第一次C程序设计上机报告
- eclipse maven插件在线安装
- Android 第三方ROM CyanogenMod 源码下载,编译,刷机
- lua 中文教程 notes.
- 蓦然回首,那些命令都在灯火阑珊处
- android 统计应用安装量
- WPF 获取屏幕长宽(分辨率)
- Linux时间函数
- 剖析游戏开发用view还是surfaceView ?
- Android - LayoutInflater (转)
- HTML 以前没有注意到内容
- python之string.maketrans和str.translate
- 浅谈国内大部分移动游戏为啥不挣钱(二)