Please comment if you have a favorite not on this list.
When rewriting large amounts of ASCII text (or comments in Code), I really find "par" helpful. : Just use it in : : vi with your cursor in front of a badly wrapped block of text. : : Press !}par and the text will be : : piped to par : : which fixes up : : the : : formatting and keeps aligned frame markers : : intact magically. : : Just use it in vi with your cursor in front of a badly wrapped : : block of text. Press…
Favorite Unix Commands
71–80 of 135 posts
Re: Favorite Unix Commands
#72sudo !! Instant favorite
$ file foo
$ ls -lh !$
$ vim !$Re: Favorite Unix Commands
#73I forgot about the DNS querying of wikipedia. Probably could've used that to entertain myself on my flights over the holidays since I'm pretty sure gogo inflight passes DNS through. Anyway, I'm a big fan of piping things into xargs. xxd is a terminal-based hex editor. It can convert both to and from hex to binary. I also use 'pgrep -lf 'partial_program_name' a lot in place of 'ps aux | grep partial_program_name'. 'pk…
Re: Favorite Unix Commands
#74This lets me cd five directories at a time, and if I want to go back, I do a "popd"
Re: Favorite Unix Commands
#75Earlier quoted context omitted.
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
#76sudo !! Instant favorite
Re: Favorite Unix Commands
#77sudo !! Instant favorite
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]
Re: Favorite Unix Commands
#78I have this in my .bashrc: function lc() { if [[ "$#" -gt 1 ]]; then for DIR in "$@"; do echo -n "$DIR - " ; ls -AU1 $DIR | wc -l ; done ; else ls -AU1 "$@" | wc -l ; fi; } So, "lc /dir" will count the number of files in /dir and "lc /dir/*" will count the files in subdirectories of /dir. This is useful if you're working in an environment where you may have thousands of files in a directory, and a regular "ls -l" wil…