Wednesday, April 16th, 2008 11:17 PM
Use this command if you want to know your command usage stats in the fish shell.
grep -v "^\#" ".config/fish/fish_history"|awk '{print $1}'|sort|uniq -c|sort -rn|head -n10
No Comments »
Sunday, April 6th, 2008 11:32 PM
View only lines that contain the word “string”
sed -n '/string/p'
No Comments »
Wednesday, February 13th, 2008 10:51 PM
Search string “test_text” at directory ‘/var/log’ and below
grep test_text -R /var/log/*
No Comments »
Friday, February 8th, 2008 11:15 PM
This command shows a graphical representation of the current sub-directories.
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'mand
Original Article
No Comments »
Tuesday, December 18th, 2007 11:35 PM
Recursively check a folder to find the given text using grep
grep -R "text" *
No Comments »
Friday, December 14th, 2007 11:12 AM
Create a command that will return the pid of the given command string..
#!/bin/sh
ps aux|grep $1|head -n1|awk '{print $2}'
No Comments »
Thursday, October 18th, 2007 10:59 PM
This one command will fetch and display the latest sensex figure in Linux. This command basically downloads a page, locates a specific line, and then extract just the necessary portion from it. I am sure you could find other uses for this method.
curl -s "http://money.rediff.com/money/jsp/markets_home.jsp" |grep ''|head -n1|perl -pe 's/^.+\">([\d\,\.]+)<\/TD>.+$/\1/i;'
No Comments »
Tuesday, September 25th, 2007 10:31 PM
Search for a specific text in a folder using grep
grep "fetchFeedPacksCustomize()" *.js
[tags]grep,search,text,folder[/tags]
No Comments »
Friday, September 14th, 2007 11:05 PM
A better way to get the process id of an application. I recommend giving an alias for this command…
ps aux|grep firefox|awk '{print $2 "\t\t" $12}'|head -n1
Replace firefox with the name of the application you are searching for.
[tags]linux,command,cli,awk,ps,process,id,grep[/tags]
No Comments »
Sunday, May 20th, 2007 02:22 PM
Use find and grep to search for a specific text in a directory. In this example, we search for files which uses the PHP short tag - <?
find -name '*.php' -exec grep '<?[^p\=]' {} \;
No Comments »
|