
Terminal - Commands using grep - 1,377 results
Q="Hello world"; GOOG_URL="http://www.google.com/search?q="; AGENT="Mozilla/4.0"; stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}\"${Q/\ /+}\"" | grep -oP '\/url\?q=.+?&' | sed 's/\/url?q=//;s/&//'); echo -e "${stream//\%/\x}"
This is sample output - yours may be different.
wb(){ for i in $(wget -O- -U "" "http://wallbase.cc/random/23/eqeq/1920x1080/0/" --quiet|grep wallpaper/|grep -oe 'http://wallbase.[^"]*'); do if (( n > "$1" )); then break;fi;let n++;wget $(wget -O- -U "" $i --quiet|grep -oe 'http://[^"]*\.jpg');done;}
This is sample output - yours may be different.
curl -s http://boards.4chan.org/---/res/nnnnnn | grep -o -i 'File: <a href="//images.4chan.org\/[a-z]*\/src\/[0-9]*\.[a-z]\{3\}' | sed -r 's/File: <a href="\/\///' |xargs wget
This is sample output - yours may be different.
Couldn't make the other work so I made this
for i in $(wget -O- -U "" "http://wallbase.cc/random/23/e..." --quiet|grep wallpaper/|grep -oe 'http://wallbase.cc[^"]*'); do wget $(wget -O- -U "" $i --quiet|grep -oe 'http://[^"]*\.jpg');done
This is sample output - yours may be different.
find $(locate hello) -type f -executable -print|grep -E "hello\$"
This is sample output - yours may be different.
/usr/bin/hello
/usr/lib/tk8.5/demos/hello
This command allow you quick find any executable by keyword(s) in your system.
NOTE: Sometime this command will output like this:
`hello.py.launch': No such file or directory
this is normal behaviour
awk '{print $1}' /proc/net/dev|grep :|sed "s/:.*//g"
This is sample output - yours may be different.
grep -e "[sh]d[a-l][0-9]\?" /proc/partitions | awk '{print $4}'
This is sample output - yours may be different.
sda
sda1
sda2
sda3
sdb
sdb1
sdb2
sdb3
grep -e "[sh]d[a-l]$" /proc/partitions | awk '{print $4}' # for disks only
grep -e "[sh]d[a-l][0-9]\+" /proc/partitions | awk '{print $4}' # for partitions only
(cat ~/.bash_history;U='curl -s www.commandlinefu.com';$U/users/signin -c/tmp/.c -d'username=<USER>&password=<PASS>&submit=1'|$U/commands/favourites/json -b/tmp/.c|grep -Po 'nd":.*?[^\\]",'|sed -re 's/.*":"(.*)",/\1/g')>~/.h;HISTFILE=~/.h bash --login
This is sample output - yours may be different.
This makes your commandlinefu.com's favorites appear as most recent commands in your history.
asterisk -rx "core show calls" | grep "active" | cut -d' ' -f1
This is sample output - yours may be different.
wget --no-use-server-timestamps $(curl $(curl http://wallbase.cc/random/23/eqeq/1920x1080/0/100/20 | grep 'wallpaper/' | awk -F'"' '{print $2}' | head -n1) | grep -A4 bigwall | grep img | awk -F'"' '{print $2}'); feh --bg-center $(ls -1t | head -n1)
This is sample output - yours may be different.
nmap -n -sP -oG - 10.10.10.*/32 | grep ": Up" | cut -d' ' -f2
This is sample output - yours may be different.
10.10.10.2
10.10.10.4
10.10.10.20
10.10.10.130
10.10.10.200
10.10.10.254
You can substitute 10.10.10.* by your own network. Or whatever nmap accepts, inlcluding submask.
ff() { find -maxdepth 3 -type f | grep -i "$1"; }; fd() { find -maxdepth 4 -type d | grep -i "$1"; }
This is sample output - yours may be different.
My most used bash function without a doubt!
find . -type f -exec file '{}' + | grep shell | awk -F':' '{print $1}' | xargs chmod u+x
This is sample output - yours may be different.
Allows to change 'shell' compatible files execution bit even if their name is not *.sh
This is sample output - yours may be different.
lsof -p `pidof pidgin` | awk '{ print $9 }'|egrep `hostname` | grep -o ">[^:]\+:" | tr -d ":>" | while read line; do host $line; done;
This is sample output - yours may be different.
wg-in-f125.1e100.net has address 239.200.3.125
wg-in-f125.1e100.net has address 239.12.3.125
wg-in-f125.1e100.net has address 173.194.78.125
wg-in-f125.1e100.net has address 239.220.3.125
baymsg1020225.gateway.edge.messenger.live.com has address 64.4.61.175
jabber-02-01-snc7.tfbnw.net has address 69.171.227.26
baymsg1020206.gateway.edge.messenger.live.com has address 64.4.61.156
vlc $(for f in /proc/$(pgrep -f libflashplayer.so |head -n 1)/fd/*; do ;if $(file ${f} |grep -q "broken symbolic link to \`/tmp/FlashXX"); then echo ${f};fi;done)
This is sample output - yours may be different.
netstat -t -p --extend | grep USERNAME
This is sample output - yours may be different.
This obtains a list of open connections that a user is connected to if he/she is using a SSH tunnel
cat index.html | grep -o '<a .*href=.*>' | sed -e 's/<a /\n<a /g' | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d'
This is sample output - yours may be different.
#
./index.html
./index2.html
http://www.google.com
./ipl.html
Extract all href links from an HTML document with sed and grep
ls | grep -Ze ".*rar" | xargs -d '\n' -I {} mv {} backup-folder
This is sample output - yours may be different.
In the example suppose we want to move all *.rar files in the current folder to a backupfolder
for folder in $( find $( pwd ) -maxdepth 1 -type d | grep -v .svn ); do svn propset svn:ignore -F ignorelist ${folder}; done
This is sample output - yours may be different.
property 'svn:ignore' set on '/home/User/workspace/parentProject'
property 'svn:ignore' set on '/home/User/workspace/parentProject/common'
property 'svn:ignore' set on '/home/User/workspace/parentProject/domain'
property 'svn:ignore' set on '/home/User/workspace/parentProject/integration'
property 'svn:ignore' set on '/home/User/workspace/parentProject/presentation'
property 'svn:ignore' set on '/home/User/workspace/parentProject/services-impl'
property 'svn:ignore' set on '/home/User/workspace/parentProject/services-intf'
property 'svn:ignore' set on '/home/User/workspace/parentProject/webservices
To use this comment you'll have to create a file entitled 'ignorelist' where you put the file name or pattern of the files you want to ignore. I used it for my maven project which generates the child project files in each folder so I can import them into eclipse. By adding these project files to the ignore list ensure they won't appear each time I run 'svn status'.
find path -name '*' -type f -print0 | xargs -0 grep -n pattern1 | grep pattern2
This is sample output - yours may be different.
The option -print0 for find and -0 for grep help prevent issue with weird characters or spaces in filenames. Furthermore with xargs there is no limited number of arguments that find can throw.
This is sample output - yours may be different.
echo "DESCRIBE dbname.table_name" | mysql -u dbusername | awk '{print $1}' | grep -v Field
This is sample output - yours may be different.
user@machine:~$ echo "describe information_schema.COLUMNS" | mysql -u root | awk '{print $1}' | grep -v Field
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_SCALE
CHARACTER_SET_NAME
COLLATION_NAME
COLUMN_TYPE
COLUMN_KEY
EXTRA
PRIVILEGES
You can execute this inside an editor to get all the fields inside your buffer and do the magic, really usefull when your tables contain a giant list of fields.
for i in {1..10};do wget $(wget -O- -U "" "http://images.google.com/images?imgsz=xxlarge&hl=en&q=wallpaper+HD&start=$(($RANDOM%900+100))" --quiet | grep -oe 'http://[^"]*\.jpg' | head -1);done
This is sample output - yours may be different.
you may want &hl=en for &hl=es for the language
you may want imgsz=xxlarge for imgsz=large or whatever filter
you may want q=apples or whatever
curl -s http://checkrealip.com/ | grep "Current IP Address" | cut -d ' ' -f 4
This is sample output - yours may be different.