- 1 Red Hat Enterprise Linux 7.2 Enters Beta with Improved Container Support
- 2 VMware CEO Pat Gelsinger Gives VMworld 5 Imperatives for Success
- 3 VMware vSphere Integrated Containers Previewed at VMworld
- 4 Worldwide Server Revenues Top $13.5 Billion in 2Q15
- 5 Blue Box OpenStack Lands on IBM Softlayer Servers
3 Handy Commandlinefu One Liners
More on Commandlinefu.com
More on Commandlinefu.comCommandlinefu is a simple repository for storing and sharing shell commands with the rest of the world. Here are three new command-line one liners that stand out.
Commandlinefu.com collects your useful command-line one liners and shares them with the rest of the world. I check it out every so often (if you're really dedicated, there are Twitter and RSS feeds), and here are some neat commands I learned recently:
!sudo tee %
If you've opened a file in Vim and forgot that you don't have permission to edit it, you can save it anyway using this command. I regularly encounter this problem, and I wish I'd known about it before. ! indicates to Vim that the rest of the line is to be passed to the shell, and % refers to the current filename. tee writes standard input to the specified file; in this case, the vim w[rite] command is the input, and it pipes the current buffer into tee to be saved.
- Ctrl-x Ctrl-e
Takes what you currently have on the commandline and dumps it into your default editor. To set your default editor, type export EDITOR=vim or add that line to your ~/.bashrc to set it permanently. This is useful for editing long and complex commands or if your terminal is behaving strangely, which I sometimes find happens at the bottom of the screen. When you save and exit the editor, the command will run.
| column -t
Shows your current mountpoints in a nice table. column is a very handy little utility that I hadn't encountered before. It takes input and turns it into, yep, columns. -t formats them as a table. It will try to guess the number of columns, or you can set them with the -c option. This is potentially useful for quick-and-dirty eyeballing of all sorts of data.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).