Found on https://bitcointalk.org/index.php?topic=55520.0
cat without comments
Remove ANSI colors from stream or file
this requires the use of a throwaway file. it outputs a shell function. assuming the throwaway file is f.tmp usage: >f.tmp;lso f.tmp > f.tmp; . f.tmp;rm f.tmp;lso -l ... notes: credit epons.org for the idea. however his version did not account for the sticky bit and other special cases. many of the 4096 permutations of file permissions make no practical sense. but chmod will still create them. one can achieve the same sort of octal output with stat(1), if that utility is available. here's another version to account for systems with seq(1) instead of jot(1): lso(){ case $# in 1) { case $(uname) in FreeBSD) jot -w '%04d' 7778 0000 7777 ;; *) seq -w 0000 7777 ;; esac; } \ |sed ' /[89]/d s,.*,printf '"'"'& '"'"';chmod & '"$1"';ls -l '"$1"'|sed s/-/./,' \ |sh \ |{ echo "lso(){"; echo "ls \$@ \\"; echo " |sed '"; sed ' s, ,@,2; s,@.*,,; s,\(.* \)\(.*\),s/\2/\1/,; s, ,,'; echo \'; echo }; }; ;; *) echo "usage: lso tmp-file"; ;; esac; } this won't print out types[1]. but its purpose is not to examine types. its focus is on mode and its purpose is to make mode easier to read (assuming one finds octal easier to read). 1. one could of course argue "everything is a file", but not always a "regular" one. e.g., a "directory" is really just a file comprising a list.
reverse of my previous command 10006 Show Sample Output
Use the excellent sensiblepasswords.com to a generate random (yet easy-to-remember) password every second, and copy it to the clipboard. Useful for generating a list of passwords and pasting them into a spreadsheet.
This script uses "madebynathan"'s "cb" function (http://madebynathan.com/2011/10/04/a-nicer-way-to-use-xclip/); you could also replace "cb" with
xclip -selection c
Remove "while true; do" and "; done" to generate and copy only 1 password.
Show Sample Output
deletes first and last line from file either empty or not.
as suggest in frans coment : '/^#[^!].*/d' -> remove if line begin with # except shebang #!/bin/bash 's/\(.*[^!]\)#.*[^}]/\1/' -> remove inline comments except shebang and ${variable#}
It remove the square bracket and convert UNIX time to human readable time for all line of a stream (or file). Show Sample Output
Delete range of lines. Ex: Line 6 through 66 in .
for music file of mp3.zing.vn Show Sample Output
A "proper" chop (the other chop example only chop's DOS-style newlines). Show Sample Output
handels @, ?, whitespaces in names. replace "?" and "add" by "!" and "rm" for svn mass remove. ---> I m looking for a nicer way to write it, perhaps with something using " perl -ne '`blahblah` if /\?(.*)/' " Show Sample Output
Prints top 5 twitter topics. Not very well written at all but none of the others worked.
Emulate (more or less) Git equivalent of
git log --format='tformat:%h %an (%cr) %s'
Show Sample Output
proc lister usage: p proc killer usage: p patt [signal] uses only ps, grep, sed, printf and kill no need for pgrep/pkill (not part of early UNIX) _p(){ ps ax \ |grep $1 \ |sed ' /grep.'"$1"'/d' \ |while read a;do printf ${a%% *}' '; printf "${a#* }" >&2; printf '\n'; done; } p(){ case $# in 0) ps ax |grep .|less -iE; ;; 1) _p $1; ;; [23]) _p $1 2>/dev/null \ |sed '/'"$2"'/!d; s,.*,kill -'"${3-15}"' &,'|sh -v ;; esac; } alas, can't get this under 255 chars. flatcap? Show Sample Output
proc lister usage: p proc killer usage: p patt [signal] uses only ps, grep, sed, printf and kill no need for pgrep/pkill (not part of early UNIX) _p(){ ps ax \ |grep $1 \ |sed ' /grep.'"$1"'/d' \ |while read a;do printf ${a%% *}' '; printf "${a#* }" >&2; printf '\n'; done; } p(){ case $# in 0) ps ax |grep .|less -iE; ;; 1) _p $1; ;; [23]) _p $1 2>/dev/null \ |sed '/'"$2"'/!d; s,.*,kill -'"${3-15}"' &,'|sh -v ;; esac; } alas, can't get this under 255 chars. flatcap? Show Sample Output
usage: dng BRE [selection] default selection is the last match DNS is ok, but although domainnames may be easier to remember than IP numbers, it still requires typing them out. This can be error-prone. Even more so than typing IPv4 numbers, depending on the domainname, its length and complexity.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: