Live data from Hacker News

Favorite Unix Commands

clippy.in

51–60 of 135 posts

Re: Favorite Unix Commands

#53
post #50

Not really a unix command, but a vi command that has been really useful, specially if you do lots of editing protected files and want to keep your custom vim configuration: !sudo tee %

What vi mode is that entered in?

Normal mode (:help :! for more information on this command).

Re: Favorite Unix Commands

#56
post #31
post #27

Earlier quoted context omitted.

tsort. It's pointless until you need it, but when you need it, it's totally awesome . less. Overkill, but SO MUCH BETTER THAN tail -f. Seriously. You can toggle "follow mode" without losing your place in the incoming stream.

Hm, can you start at the end of file without reading the entire file with less? Use case is tailing large logs.

Yes, either type G when presented with the top of the file or pass +G on the command line. It will then read all the intervening file to calculate the line numbers, and tells you it's doing this and to interrupt it to stop. To prevent it doing this in the first place use the -n option.

"less -n huge_file" and then G only reads the start and end of the file. Type G again to move to the latest end of the file if it's growing.

Re: Favorite Unix Commands

#58
post #53
post #50

Earlier quoted context omitted.

What vi mode is that entered in?

Normal mode (:help :! for more information on this command).

What benefit does

    :!sudo tee %
have over doing it at the command line other than filling in the current filename for you? I suspect the original poster meant something like "gg!Gsudo tee %".

Re: Favorite Unix Commands

#60

grep -r . "some random debug message" (searches for the passage recursively in all files from the directory it was executed, the main reason I like developing in linux more than windows)

If you are searching inside code specifically, you may like 'ack'. It does the same thing grep does, except it has preset 'excludes', is recursive by default, and the output is a bit prettier.
Post reply on HN