Live data from Hacker News

Favorite Unix Commands

clippy.in

101–110 of 135 posts

Re: Favorite Unix Commands

#104
post #77

Earlier quoted context omitted.

I don't find this one useful. [up-arrow] automatically inserts the last command, which gives a generic mechanism to correct the command and it requires no more typing than !!: [up-arrow][control-a]sudo [enter]

moving your hand over to arrow keys is why I would use the sudo !! version.

[control-p] then ;)

Re: Favorite Unix Commands

#105
Check fasd, it will blow your mind, be prepared! :) Fasd (pronounced similar to "fast") is a command-line productivity booster.

I've been using this for a while, and trust me, its changed my command line workflow, and I wish, this should come as inbuilt for all POSIX shells!

Here is how it works -

If you use your shell to navigate and launch applications, fasd can help you do it more efficiently. With fasd, you can open files regardless of which directory you are in. Just with a few key strings, fasd can find a "frecent" file or directory and open it with command you specify. Below are some hypothetical situations, where you can type in the command on the left and fasd will "expand" your command into the right side. Pretty magic, huh?

  v def conf       =>     vim /some/awkward/path/to/type/default.conf
  j abc            =>     cd /hell/of/a/awkward/path/to/get/to/abcdef
  m movie          =>     mplayer /whatever/whatever/whatever/awesome_movie.mp4
  o eng paper      =>     xdg-open /you/dont/remember/where/english_paper.pdf
  vim `f rc lo`    =>     vim /etc/rc.local
  vim `f rc conf`  =>     vim /etc/rc.conf
Fasd offers quick access to files and directories for POSIX shells. It is inspired by tools like autojump, z and v. Fasd keeps track of files and directories you have accessed, so that you can quickly reference them in the command line.

The name fasd comes from the default suggested aliases f(files), a(files/directories), s(show/search/select), d(directories).

Fasd ranks files and directories by "frecency," that is, by both "frequency" and "recency." The term "frecency" was first coined by Mozilla and used in Firefox.

Here is the Link - https://github.com/clvv/fasd

Re: Favorite Unix Commands

#106

Earlier quoted context omitted.

Or even 'ag' (the silver searcher). Like ack, but "better". https://github.com/ggreer/the_silver_searcher

"better" or just faster since its written in C ? It is not a drop-in replacement for ack. e.g. there are some basic usages it does not support -- iirc counts (ag -c pattern).

Eh, faster is faster, does it matter why?

Re: Favorite Unix Commands

#109

I like those un- commands for easier archive extracting, e.g.: alias unbz2='tar xvjf' alias untar='tar xvfz'

Fortunately GNU tar has gotten smarter. You can do just "tar xvf" now and it will do the right thing whether the archive is compressed or not.

When creating the archive, you still have to use your favorite compression method (XZ aka LZMA, activated with J is even better, but slightly slower, than bzip).

Re: Favorite Unix Commands

#110

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)

    grep -rs
or (more commonly for me):-

    grep -rsi
(The -s supresses errors about unreadable files that may clutter the output. -i for case insensitivity.)
Post reply on HN