问题描述
所有程序员都应该知道很多事情,但是我对Unix / Linux命令特别感兴趣,我们应该知道。对于完成我们在某些时候可能遇到的任务,例如重构,报告,网络更新等。
我很好奇的原因是因为以前在一个软件公司工作,而我在学习我的学位,我注意到所有的开发人员(谁正在开发Windows软件)有2台电脑。
左侧是他们的Windows XP开发机器,右侧是一个Linux盒子。我认为是Ubuntu。无论如何,他们告诉我,他们使用它,因为它提供了强大的unix操作,Windows不能在他们的开发过程中。
这让我很好奇地知道,作为一个软件工程师你相信是什么最强大的脚本/命令/用途,你可以在Unix / Linux操作系统上执行每个程序员应该知道解决现实世界的任务,可能不一定涉及到编写代码?
我们都知道 sed , awk 和 grep 的作用。我感兴趣的一些实际的Unix / Linux脚本部分,已经解决了一个困难的问题,让其他程序员可以受益。请提供您的故事和来源。
我确定有很多这样的例子,人们保留在他们的脚本 p>
更新:人们似乎误解了这个问题。我不是要求单个unix命令的名称,而是要求解决一个问题的UNIX代码片段。
社区
遍历目录树并打印出符合正则表达式的任何文件的路径:
查找。 -exec grep -l -e'myregex'{} \; >> outfile.txt
调用默认编辑器(Nano / ViM) p>
Ctrl + x Ctrl + e
列出所有正在运行的网络连接(包括它们属于哪个应用程序)
lsof -i -nP
终端的搜索记录(我最喜欢的另一个)
历史-c
社区的最佳答案
遍历目录树并打印出符合正则表达式的任何文件的路径:
find。 -exec grep -l -e'myregex'{} \; >> outfile.txt
调用默认编辑器(Nano / ViM) p>
Ctrl + x Ctrl + e
列出所有正在运行的网络连接(包括它们属于哪个应用程序)
lsof -i -nP
终端的搜索记录(我最喜欢的另一个)
历史-c
There are many things that all programmers should know, but I am particularly interested in the Unix/Linux commands that we should all know. For accomplishing tasks that we may come up against at some point such as refactoring, reporting, network updates etc.
The reason I am curious is because having previously worked as a software tester at a software company while I am studying my degree, I noticed that all of developers (who were developing Windows software) had 2 computers.
To their left was their Windows XP development machine, and to the right was a Linux box. I think it was Ubuntu. Anyway they told me that they used it because it provided powerful unix operations that Windows couldn't do in their development process.
This makes me curious to know, as a software engineer what do you believe are some of the most powerful scripts/commands/uses that you can perform on a Unix/Linux operating system that every programmer should know for solving real world tasks that may not necessarily relate to writing code?
We all know what sed, awk and grep do. I am interested in some actual Unix/Linux scripting pieces that have solved a difficult problem for you, so that other programmers may benefit. Please provide your story and source.
I am sure there are numerous examples like this that people keep in their 'Scripts' folder.
Update: People seem to be misinterpreting the question. I am not asking for the names of individual unix commands, rather UNIX code snippets that have solved a problem for you.
Best answers from the Community
Traverse a directory tree and print out paths to any files that match a regular expression:
find . -exec grep -l -e 'myregex' {} \; >> outfile.txt
Invoke the default editor(Nano/ViM)
Ctrl+x Ctrl+e
List all running network connections (including which app they belong to)
lsof -i -nP
Clear the Terminal's search history (Another of my favourites)
history -c
Best answers from the Community
Traverse a directory tree and print out paths to any files that match a regular expression:
find . -exec grep -l -e 'myregex' {} \; >> outfile.txt
Invoke the default editor(Nano/ViM)
Ctrl+x Ctrl+e
List all running network connections (including which app they belong to)
lsof -i -nP
Clear the Terminal's search history (Another of my favourites)
history -c
这篇关于最强大的Unix命令或脚本的例子每个程序员都应该知道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!