UnixToolTip's profile picture. Tips on Unix utilities and related topics from @JohnDCook.

Unix tool tip

@UnixToolTip

Tips on Unix utilities and related topics from @JohnDCook.

Ghim

'The enjoyment of one's tools is an essential ingredient of successful work.' -- Donald E. Knuth


When giving numeric arguments to the find utility, + means greater than and - means less than. e.g. +7 means greater than 7.


In Emacs, to send the contents of a region to a shell command, use M-|.


Unix tool tip đã đăng lại

"no Shakespeare yet -- only syntactically correct Bash scripts"

effectfully's tweet image. "no Shakespeare yet -- only syntactically correct Bash scripts"

Unix tool tip đã đăng lại

Legend has it gym memberships are particularly hard to cancel here because nobody knows how to exit

kvlly's tweet image. Legend has it gym memberships are particularly hard to cancel here because nobody knows how to exit

'With only s and d you should probably find a use for sed once a week.' -- @WilsonEricN


Replace string in a huge (70GB), one line, text file unix.stackexchange.com/questions/4136…


Trim leading and trailing whitespace: sed -i 's/^[ \t]*//;s/[ \t]*$//' somefile


Example from my latest blog post: sample a file with replacement, choosing 12 items: shuf -n 12 -r file.txt


Boolean operators in find: -not, -or. There's no 'and' because 'and' is implicit when two requirements are listed.


Seven habits of effective text editing moolenaar.net/habits.html // general principles, examples with Vim


Can show all environment variables with printenv. Probably want to pipe to less.


Repeat a shell command, replacing all instances of a word with something new johndcook.com/blog/2022/10/2…


Trim leading whitespace: sed -i 's/^[ \t]*//' somefile


'A successful software tool is one that was used to do something undreamed of by its author.' -- Stephen Johnson


Limit find's depth of search with the -maxdepth option.


If you only want to know whether two files differ, not how they differ, use diff -q (or --brief).


Awk can use a pair of regular expressions as a range, just like sed. In both languages, /foo/,/bar/ matches the same lines.


Loading...

Something went wrong.


Something went wrong.