Tails make.out file and pipes it to sed which uses 3 colors: green: percentage (eg: 10%) yellow: warning (case insensitive) red: error (case insensitive)
Tail all logs that are opened by all java processes. This is helpful when you are on a new environment and you do not know where the logs are located. Instead of java you can put any process name. This command does work only for Linux.
The list of all log files opened by java process:
sudo ls -l $(eval echo "/proc/{$(echo $(pgrep java)|sed 's/ /,/')}/fd/")|grep log|sed 's/[^/]* //g'
like #9295, but awkish instead of perlish
tail() { thbin="/usr/bin/tail"; if [ "${1:0:1}" != "-" ]; then fc=$(($#==0?1:$#)); lpf="$((($LINES - 3 - 2 * $fc) / $fc))"; lpf="$(($lpf<1?2:$lpf))"; [ $fc -eq 1 ] && $thbin -n $lpf "$@" | /usr/bin/fold -w $COLUMNS | $thbin -n $lpf || $thbin -n $lpf "$@"; else $thbin "$@"; fi; unset lpf fc thbin; }
This is a function that implements an improved version of tail. It tries to limit the number of lines so that the screen is filled completely. It works with pipes, single and multiple files. If you add different options to tail, they will overwrite the settings from the function.
It doesn't work very well when too many files (with wrapped lines) are specified.
Its optimised for my three-line prompt.
It also works for head. Just s/tail/head/g
Don't set 'thbin="tail"', this might lead to a forkbomb.
logtop show number of lines per second, also classify them so you can show a "top" of every aspect of your logfile : tail -f access.log | awk '{print $1; fflush();}' | logtop
The rsstail is the python version (python-rsstail). The final command pipe it on every new line to gammu and a connected phone
rsstail -o -n 1 --f 'RedditQuote: {title}' http://www.reddit.com/r/quotes/new/.rss | while read line; do /usr/bin/gammu --sendsms TEXT +*yournumber* -text "$line"; done
Show Sample Output
List all files in a directory in reverse order by modified timestamp. When piped through tail the user will see the most recent file name.
This is a little trickier than finding the last Sunday, because you know the last Sunday is in the first position of the last line. The trick is to use the NF less than or equal to 7 so it picks up all the lines then grep out any empty lines. Show Sample Output
Watches for file modifications in the current directory and tails the file.
Tail is much faster than sed, awk because it doesn't check for regular expressions. Show Sample Output
Yep, now you can finally google from the command line!
Here's a readable version "for your pleasure"(c):
google() { # search the web using google from the commandline
# syntax: google google
query=$(echo "$*" | sed "s:%:%25:g;s:&:%26:g;s:+:%2b:g;s:;:%3b:g;s: :+:g")
data=$(wget -qO - "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=$query")
title=$(echo "$data" | tr '}' '\n' | sed "s/.*,\"titleNoFormatting//;s/\":\"//;s/\",.*//;s/\\u0026/'/g;s/\\\//g;s/#39\;//g;s/'amp;/\&/g" | head -1)
url="$(echo "$data" | tr '}' '\n' | sed 's/.*"url":"//;s/".*//' | head -1)"
echo "${title}: ${url} | http://www.google.com/search?q=${query}"
}
Enjoy :)
Show Sample Output
I know how hard it is to find an old command running through all the files because you couldn't remember for your life what it was. Heres the solution!! Grep the history for it. depending on how old the command you can head or tail or if you wanted to search all because you cannot think how long ago it was then miss out the middle part of the command. This is a very easy and effective way to find that command you are looking for.
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: