
Terminal - Commands using grep - 1,375 results
find . -name "*.pdf" -exec pdftk {} dump_data output \; | grep NumberOfPages | awk '{s+=$2} END {print s}'
This is sample output - yours may be different.
aptitude purge $(dpkg -l|grep ^rc|awk '{ print $2 }')
This is sample output - yours may be different.
ps -xaw -o state,ppid | grep Z | grep -v PID | awk '{ print $2 }' | xargs kill -9
This is sample output - yours may be different.
Did some research and found the previous command wrong, we don't kill a zombie but its parent. Just made some modifcation to khashmeshab's command.
curl -s -L http://nytm.org/made-in-nyc | grep "(hiring)" | sed -re 's/<([^>]+)>//g;s/^([ \t]*)//g'
This is sample output - yours may be different.
apt-get --ignore-hold --allow-unauthenticated -s dist-upgrade | grep ^Inst | cut -d ' ' -f2
This is sample output - yours may be different.
linux-image-3.2.0-35-virtual
gpgv
gnupg
man-db
linux-image-virtual
Taken from apticron and modified.
ls -l /dev/disk/by-id | egrep ata-.*`hdparm -i /dev/sda | grep SerialNo | sed 's/.*SerialNo=//' | tr -d "\n"`.*sda$ | sed -e 's/.*ata-/ata-/' -e 's|[ ].*||' | tr -d "\n"
This is sample output - yours may be different.
This was tested on Ubuntu 12.04 (Precise) LTS Server. It returns the name of the symlink within /dev/disk/by-id for the physical drive you specify. Change /dev/sda to the one you want, and replace ata- with scsi- or the appropriate type for your drive.
I used this to pre-configure grub-pc during a non-interactive install because I had to tell it which disk to install grub on, and physical disks don't have a UUID such as that blkid provides.
curl http://en.m.wikipedia.org/wiki/List_of_Internet_top-level_domains | grep "<tr valign=\"top\">" | awk -F">" '{ print $5 }' | awk -F"<" '{ print $1 }'
This is sample output - yours may be different.
.aero
.asia
.biz
.cat
.com
.coop
.info
.int
.jobs
.mobi
.museum
... ETC
Oneliner to get domain names list of all existing domain names (from wikipedia)
find -type f | xargs file | grep ".*: .* text" | sed "s;\(.*\): .* text.*;\1;"
This is sample output - yours may be different.
/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
This is sample output - yours may be different.
sudo dmidecode | grep Product
This is sample output - yours may be different.
Product Name: VirtualBox
Product Name: VirtualBox
Command used to know if we are working on a virtual or physical machine. This command will use the dmidecode utility to retrieve hardware information of your computer via the BIOS. Run this command as root or with sudo.
grep -l 'flags.*\<lm\>' /proc/cpuinfo && (getconf LONG_BIT | grep '64') && java -version
This is sample output - yours may be different.
/proc/cpuinfo
64
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
Let's you examine, for example, whether infrastructure folks really provisioned the correct setup.
Java 64-bit checklist
1. check if hardware is 64-bit capable by looking for lm flag
grep -l 'flags.*\<lm\>' /proc/cpuinfo
2. check if kernel is 64-bit
getconf LONG_BIT | grep '64'
3. check if java is 64-bit (simply look for 64-bit in output - if present, then it is, if absent, then it is 32-bit)
java -version
This is sample output - yours may be different.
user@ubuntu:~$ ps axu | grep [a]pache2
root 9399 0.0 0.1 105628 7588 ? SNs 11:55 0:01 /usr/sbin/apache2 -k start
www-data 9401 0.0 0.1 105716 5576 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9402 0.0 0.1 105716 5572 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9403 0.0 0.1 105668 5028 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9404 0.0 0.1 105716 5576 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 9405 0.0 0.1 105652 4788 ? SN 11:55 0:00 /usr/sbin/apache2 -k start
www-data 15581 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
www-data 15582 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
www-data 15583 0.0 0.1 105652 4788 ? SN 12:04 0:00 /usr/sbin/apache2 -k start
Trick to avoid the form:
grep process | grep - v grep
48 function gbl() { git for-each-ref --sort=-committerdate --format='%(committerdate) %(authorname) %(refname)' refs/remotes/origin/|grep -e ".$@"|head -n 10; }
This is sample output - yours may be different.
gbl soheil
Tue Dec 4 18:01:19 2012 -0800 Soheil refs/remotes/origin/branch3
Mon Nov 26 10:55:55 2012 -0800 Soheil refs/remotes/origin/branch2
Thu Nov 15 11:44:52 2012 -0800 Soheil refs/remotes/origin/branch1
find . -type d | while read dir ; do num=`ls -l $dir | grep '^-' | wc -l` ; echo "$num $dir" ; done | sort -rnk1 | head
This is sample output - yours may be different.
A lot of files in one dir is not so cool for filesystem.
for line in `wget --referer='http://500px.com/' --quiet -O- http://500px.com/popular | grep "from=popular" | sed -n 's/.*<img src="\([^"]*\)".*/\1/p' | sed s/"3.jpg"/"4.jpg"/ | sed s/"?t".*$//`; do wget -O $RANDOM.jpg --quiet "$line"; done
This is sample output - yours may be different.
This command downloads the actual 20 most popular pictures from the website 500px. It uses a random name due to the fact the the pictures in 500px are stored with the same name.
UPDATED: doesn't work if no referrer is specified: --referer='http://500px.com/'
grep postfix /var/log/messages | audit2allow -M mypolicy
This is sample output - yours may be different.
This is sample output - yours may be different.
inet addr:10.11.12.123 Bcast 10.11.12.255 Mask: 255.255.255.0
Returns the IP, broadcast, and subnet mask of your interfaces absent any other extraneous info.
I know it's a bit lame, but I've created an alias for this when I *quickly* want to know what a system's IP is. Small amounts of time add up :)
ifconfig |grep broadcast | awk '{print $2}'
This is sample output - yours may be different.
get the ip address on your LAN
ifconfig |grep broadcast | awk '{print $2}'
This is sample output - yours may be different.
get the ip address on your LAN
${execi 300 lynx --dump http://www.commandlinefu.com/commands/random/plaintext | grep .}
This is sample output - yours may be different.
# commandlinefu.com by David Winterbottom
# back ssh from firewalled hosts
ssh -R 5497:127.0.0.1:22 -p 62220 user@public.ip
command for conky. To update a random command for each 300 sec from commandline.com
find . -name "*.[ch]" -exec grep -i /dev/null "search pharse" {} \;
This is sample output - yours may be different.
Old Sys5 system and SUN computers don't have the -H option. Adding /dev/null forces grep to use the multi-file output and report the file name.
ifconfig eth0 | grep HW | cut -d " " -f 11
This is sample output - yours may be different.
scrotit(){ echo "Screenshot in $1 seconds...";scrot -d $1 '%Y%m%d%h.png' -e 'curl -sF file1=@- http://ompldr.org/upload < $f | grep -P -o "(?<=File:).*(http://ompldr.org/.*)\<\/a\>";rm $f'| sed -r 's@.*(http://ompldr.org/\w{1,7}).*@\1@';}
This is sample output - yours may be different.
$ scrotit(){ echo "Screenshot in $1 seconds...";scrot -d $1 '%Y%m%d%h.png' -e 'curl -sF file1=@- http://ompldr.org/upload < $f | grep -P -o "(?<=File:).*(http://ompldr.org/.*)\<\/a\>";rm $f'| sed -r 's@.*(http://ompldr.org/\w{1,7}).*@\1@';}
$ scrotit 5
Sreenshot in 5 seconds...
http://ompldr.org/vZ2pqaQ
$
Take a screenshot, give $1 seconds pause to choose what to screenshot, then upload and get URI of post in ompdlr.org
omp(){ $*|convert label:@- png:-|curl -sF file1=@- http://ompldr.org/upload | grep -P -o "(?<=File:).*(http://ompldr.org/.*)\<\/a\>" | sed -r 's@.*(http://ompldr.org/\w{1,7}).*@\1@';}
This is sample output - yours may be different.
$ cat /etc/issue | omp
http://ompldr.org/vZ2pkNQ
Create a .png from output command or whatever, the upload and give URI from ompdlr.org
dig @resolver1.opendns.com myip.opendns.com | grep ^myip.opendns.com | tr '\t' : | cut -d: -f5
This is sample output - yours may be different.