
Terminal - Commands using cat - 387 results
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
cat /dev/urandom | pv -L 3m | dd bs=1M count=100 iflag=fullblock > /dev/null
This is sample output - yours may be different.
This example will close the pipe after transferring 100MB at a speed of 3MB per second.
cat ~/.ssh/id_rsa.pub | ssh tester@10.2.6.10 "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys"
This is sample output - yours may be different.
chmod authorized_keys so you don't get "Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh tester@10.2.6.10 "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys"
This is sample output - yours may be different.
chmod authorized_keys so you don't get "Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys"
cat .ssh/id_rsa.pub | ssh user@server 'cat >> ~/.ssh/authorized_keys2'
This is sample output - yours may be different.
cat ~/.bash_history | perl -lane 'if($F[0] eq "sudo"){$hash{$F[1]}++}else{$hash{$F[0]}++};$all++;END {@top = map {[$_, $hash{$_}]} sort {$hash{$b}<=>$hash{$a}} keys %hash;printf("%10s%10d%10.2f%%\n", $_->[0],$_->[1],$_->[1]/$all*100) for @top[0..9]}'
This is sample output - yours may be different.
This is sample output - yours may be different.
This will be very helpful when you are debugging shell scripts, where
you don?t want to display the echo statement and interested in only
looking at the error messages. Similarly use 2> to supress error messages
diff <(ssh user@host cat /path/to/remotefile) /path/to/localfile
This is sample output - yours may be different.
watch -n 1 cat /proc/net/wireless
This is sample output - yours may be different.
Every 1.0s: cat /proc/net/wireless Thu Jun 7 05:34:54 2012
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 70. -36. -256 0 0 0 0 0 0
Values will depend on the driver and the hardware specifics, so you need to refer to your driver documentation for proper interpretation of those values.
cat urls.txt | wget -i- -T 10 -t 3 --waitretry 1
This is sample output - yours may be different.
cat urls.txt | xargs -n1 curl -O --max-time 10 --retry 3 --retry-delay 1
This is sample output - yours may be different.
cat /var/log/nginx/access.log | grep -oe '^[0-9.]\+' | perl -ne 'system("geoiplookup $_")' | grep -v found | grep -oe ', [A-Za-z ]\+$' | sort | uniq -c | sort -n
This is sample output - yours may be different.
71 , Poland
116 , France
300 , United States
2426 , Spain
Per country GET report, based on access log. Easy to transform to unique IP
while true; do sudo cat /dev/input/mouse0|read -n1;streamer -q -o /tmp/cam.jpeg -s 640x480 > /dev/null 2>&1; sleep 10;done
This is sample output - yours may be different.
This takes a webcam picture every everytime the mouse is moved (waits 10 seconds between checking for movement) and stores the picture wherever you want it.
Ideas:
Use in conjunction with a dropbox type application to see who is using your computer
Use /dev/input/mice if /dev/input/mouse* doesn't work
Use the bones of this to make a simple screensaver
while true; do iptables -nvL > /tmp/now; diff -U0 /tmp/prev /tmp/now > /tmp/diff; clear; cat /tmp/diff; mv /tmp/now /tmp/prev; slee p 1; done
This is sample output - yours may be different.
@@ -28 +28 @@
- 339 27684 zone_lan_forward all -- br-lan * 0.0.0.0/0 0.0.0.0/0
+ 340 27768 zone_lan_forward all -- br-lan * 0.0.0.0/0 0.0.0.0/0
this alternative shows the differences as they occur so that they are made plain
yes "" | cat -n | awk '{print "S=`echo All work and no play makes Jack a dull boy. | cut -c",($1 - 1) % 43 + 1 "`;echo -n \"$S\";seq 500000 > /dev/null"}'| bash
This is sample output - yours may be different.
All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All awork and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.All work and no play makes Jack a dull boy.
This is sample output - yours may be different.
cat z.log | perl -ne 'BEGIN{ print "DATE;RATE\n"; } /\[(\d.*)\]/ && print $1; /CURRENT RATE: +(\S+) msg.*/ && print ";" .$1 . "\n"; '
This is sample output - yours may be different.
from file:
@SG: --------------------------------------------------------------------
@SG: [pmphost6] [2012-04-02 21:23:59.268]
@SG: --------------------------------------------------------------------
@SG: [SAFEGUARD STATUS]
@SG: > RATE THRESHOLD: 30 msg/sec
@SG: > TIME TO LIVE: 1800 sec
@SG: > CURRENT RATE: 43.017 msg/sec 2581.000 msg/min
@SG: > ELAPSED TIME: 60 sec
@SG: > TIME COUNT: 0 sec
@SG: > TIME TO LIVE COUNT: 360 sec
@SG: > SAFEGUARD STATUS: ON
@SG: --------------------------------------------------------------------
@SG: --------------------------------------------------------------------
@SG: [pmphost6] [2012-04-02 21:24:59.268]
@SG: --------------------------------------------------------------------
@SG: [SAFEGUARD STATUS]
@SG: > RATE THRESHOLD: 30 msg/sec
@SG: > TIME TO LIVE: 1800 sec
@SG: > CURRENT RATE: 42.417 msg/sec 2545.000 msg/min
@SG: > ELAPSED TIME: 60 sec
@SG: > TIME COUNT: 0 sec
@SG: > TIME TO LIVE COUNT: 420 sec
@SG: > SAFEGUARD STATUS: ON
@SG: --------------------------------------------------------------------
@SG: --------------------------------------------------------------------
@SG: [pmphost6] [2012-04-02 21:25:59.269]
@SG: --------------------------------------------------------------------
@SG: [SAFEGUARD STATUS]
@SG: > RATE THRESHOLD: 30 msg/sec
@SG: > TIME TO LIVE: 1800 sec
@SG: > CURRENT RATE: 42.833 msg/sec 2570.000 msg/min
@SG: > ELAPSED TIME: 60 sec
@SG: > TIME COUNT: 0 sec
@SG: > TIME TO LIVE COUNT: 480 sec
@SG: > SAFEGUARD STATUS: ON
@SG: --------------------------------------------------------------------
estract csv
DATE;RATE
2012-04-02 21:23:59.268;43.017
2012-04-02 21:24:59.268;42.417
2012-04-02 21:25:59.269;42.833
extract data in multiline blocks of data with perl pattern matching loop
pdftk A=1.pdf B=2.pdf C=3.pdf cat C A output CA.pdf
This is sample output - yours may be different.
pdftk 1.pdf 2.pdf cat output 12.pdf
This is sample output - yours may be different.
This is sample output - yours may be different.
Write script or commands in notepad/Editplus/MS word etc, copy the contents, type the above command and click on enter now, paste by right click-ing the mouse. Entire contents in the clip-board gets pasted now again click on Enter to go to new line/next line. Press Ctrl+D to close/save the file. Not always required to vi to create a new file.
wget -q ip.nu && cat index.html
This is sample output - yours may be different.
find . -type f -name "*.*" -exec cat {} > totalLines 2> /dev/null \; && wc -l totalLines && rm totalLines
This is sample output - yours may be different.
ps h --ppid $(cat /var/run/apache2.pid) | awk '{print"-p " $1}' | xargs sudo strace
This is sample output - yours may be different.
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.
for a in $(cat sample.txt); do echo "${#a} $a";done|sort -n
This is sample output - yours may be different.
for a in $(cat sample.txt); do echo "$(wc -m<<<$a) $a";done|sort -n
This is sample output - yours may be different.
optionally you can add
|cut -d' ' -f2|uniq
to the end of the command line.