Live data from Hacker News

What's the one Linux command you wish you knew years ago?

reddit.com

51–60 of 216 posts

Re: What's the one Linux command you wish you knew years ago?

#51
post #3

100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -

http://www.vim.org/scripts/script.php?script_id=1723

vimpager. Set vim as your pager. I love reading man pages in syntax-colored vim glory.

Re: What's the one Linux command you wish you knew years ago?

#52
post #24

That reddit thread is delightful, because it is full of wonderful commands that I didn't know, or rarely use, or had forgotten. But it's also terrifying, because it exposes how many people will post questions before using man.

Many comments seem to be shell- and bash-related. Perhaps the thread exposes how difficult to read the bash manpage is. On my system, the bash 4.1 manpage is 41026 words long, or about 80 pages. Manpages are most useful to me when they are short and to-the-point so I can find what I am looking for before I lose interest in skimming through an 80 page book.

Re: What's the one Linux command you wish you knew years ago?

#59
post #8
post #6

Earlier quoted context omitted.

Never thought to use ``. I always used xargs: find . -name *.java | xargs cat | wc -l

Your approach works better than backtick expansion, since it won't run into 'command line too long' issues; but it will still break on "weird" file names (e.g., file names with spaces in them). The correct way to do this is find . -name *.java -print0 | xargs -0 cat | wc -l

That glob could cause trouble.

    find . -name '*.java' -print0 | xargs -0 cat | wc -l

Re: What's the one Linux command you wish you knew years ago?

#60
post #3

100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -

Did you know that Ctrl-s will search forwards through the history too? You'll have to switch flow control off first.
Post reply on HN