
Terminal - Commands using cat - 449 results
nmap -sP <subnet>.* | egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' > results.txt ; for IP in {1..254} ; do echo "<subnet>.${IP}" ; done >> results.txt ; cat results.txt | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | uniq -u
This is sample output - yours may be different.
for i in $(ps -ef | awk '{print $2}') ; { swp=$( awk '/Swap/{sum+=$2} END {print sum}' /proc/$i/smaps ); if [[ -n $swp && 0 != $swp ]] ; then echo -n "\n $swp $i "; cat /proc/$i/cmdline ; fi; } | sort -nr
This is sample output - yours may be different.
4428 9187 python/usr/share/system-config-printer/applet.py
2012 9163 gnome-panel
1516 9127 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
1408 18899 /usr/lib/gvfs/gvfsd-smb--spawner:1.9/org/gtk/gvfs/exec_spaw/4
1040 1681 gnome-terminal
Col 1 is swapped sum in kb
Col 2 is pid of process
Col 3 is command that was issued
cat -n <file> | sort -k 2 | uniq -f 1 | sort -n | cut -f 2-
This is sample output - yours may be different.
i wanted to delete all duplicate lines from .bash_history and keep the order of the other lines.
the command cat's the file and adds line numbers, then sorts by the second column. afterwards uniq omits repeated lines, but skips the first field (the line number). then it sorts by the line numbers and at the end cuts the numbers off.
# cat file1.mp3 file2.mp3 > file3.mp3
This is sample output - yours may be different.
cat - concatenate MP3 files and save it...
(bzcat BZIP2_FILES && cat TEXT_FILES) | grep -E "Invalid user|PAM" | grep -o -E "from .+" | awk '{print $2}' | sort | uniq >> /etc/hosts.deny
This is sample output - yours may be different.
Searches all log files (including archived bzip2 files) for invalid user and PAM authentication errors, both of which are indicative of brute force attempts at logging into computer. A list of all unique IP addresses and domain names is appended to hosts.deny. The command (and grep error messages) will work on Mac OS X 10.6, small adjustments may be needed for other OSs.
ssh HOST cat < LOCALFILE ">" REMOTEFILE
This is sample output - yours may be different.
ps aux | grep [h]ttpd | cat -n
This is sample output - yours may be different.
If you're on a system that doesn't have nl, you can use cat -n.
cat ~/.ssh/id_rsa.pub | ssh <remote_host> "xargs --null echo >> ~/.ssh/authorized_keys"
This is sample output - yours may be different.
Well its just appending your public key to the remote hosts authorized_keys, but can get messy logging in and out
cat infile | while read str; do echo "$((++i)) - $str" ; done;
This is sample output - yours may be different.
Yep, is hard, but is a way more flexible using pipe.
This is sample output - yours may be different.
cat </dev/tcp/time.nist.gov/13
This is sample output - yours may be different.
cat </dev/tcp/time.nist.gov/13
55168 09-12-03 20:32:43 00 0 0 350.2 UTC(NIST) *
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | sed 1q
This is sample output - yours may be different.
cat ~/.viminfo | sed -n '/^:[0-9]\+,\([0-9]\+\|\$\)s/p'
This is sample output - yours may be different.
i want to count how many regex code i have used in vim in a long time
so i make a directory in svn host and post record to this directory
of course i dont want to post manually so i worte a script to do that
and this is the core thing to do
while true; do wget -r -l1 --no-clobber -A.txt http://911.wikileaks.org/files/index.html; done; cat *.txt | grep pass
This is sample output - yours may be different.
2001-09-11 17:37:01 Skytel [003937285] B ALPHA A conference call is scheduled 1700 CDT on 9-11-01. Current plans to address security, dvrtd flts & resumption of svc.Outside phn 1-800-857-3412; Unitel 8-888-0484; Intl 1-312-470-7298. Passcode 93390#. ordoo-becky johnson -recommend
2001-09-11 17:20:58 Skytel [002863587] A ALPHA kinc: CODERED-BU: Call 1-888-224-0047, passcode 212-762-2317. Call
2001-09-11 19:14:46 Skytel [005253896] C ALPHA Joanne. Up on my latop is a word doc (telesales contract) please email to BAM Asap. my password is still campbell- CC -recommend
2001-09-11 18:33:01 Arch [0472521] C ALPHA . R.R.R.A.T. ALERT from HEAT . Please call 1-800-453-7412 NOW! Client ID=154571; Password=331340 .RANCE KNISLEY reports: .TKT 00556495 opened. -recommend
[ $1 == "client" ] && hostname || cat $0 | ssh $1 /bin/sh -s client
This is sample output - yours may be different.
Now put more interesting stuff on the script in replacement of hostname, even entire functions, etc, and stuff.
hosta> cat myScript.sh
#!/bin/sh
[ $1 == "client" ] && hostname || cat $0 | ssh $1 /bin/sh -s client
hosta> myScript.sh hostb
hostb
hosta>
cat /var/log/httpd/access_log | grep q= | awk '{print $11}' | awk -F 'q=' '{print $2}' | sed 's/+/ /g;s/%22/"/g;s/q=//' | cut -d "&" -f 1 | mail
[email protected] -s "[your-site] search strings for `date`"
This is sample output - yours may be different.
It's not a big line, and it *may not* work for everybody, I guess it depends on the detail of access_log configuration in your httpd.conf. I use it as a prerotate command for logrotate in httpd section so it executes before access_log rotation, everyday at midnight.
cat *.c | { printf "se te du\nplot '-' t '' w dots\n"; tr '[[:upper:]]' '[[:lower:]]' | tr -s [[:punct:][:space:]] '\n' | sort | uniq -c | sort -nr | head -n 100 | awk '{print $1}END{print "e"}'; } | gnuplot
This is sample output - yours may be different.
$ cat *.c | { printf "se te du\nplot '-' t '' w dots\n"; tr '[[:upper:]]' '[[:lower:]]' | tr -s [[:punct:][:space:]] '\n' | sort | uniq -c | sort -nr | head -n 100 | awk '{print $1}END{print "e"}'; } | gnuplot
60 .+-----+------+------+------+-------+------+------+------+------+-----++
+ + + + + + + + + + +
| |
50 ++ ++
| |
|. |
|. |
40 ++ ++
| |
| .. |
30 ++ ++
| . |
| |
20 ++ .. ++
| .. |
| .. |
| ... |
10 ++ .... ++
| ............... |
+ + + + + .......................................+
0 ++-----+------+------+------+-------+------+------+------+------+-----++
0 10 20 30 40 50 60 70 80 90 100
Uses the dumb terminal option in gnuplot to plot a graph of frequencies. In this case, we are looking at a frequency analysis of words in all of the .c files.
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
This is sample output - yours may be different.
require the pdftk package
cat /path/to/some/file.txt | tee /dev/pts/0 | wc -l
This is sample output - yours may be different.
This is a cool trick to view the contents of the file on /dev/pts/0 (or whatever terminal you're using), and also send the contents of that file to another program by way of an unnamed pipe. All the while, you've not bothered saving any extra data to disk, like you might be tempted to do with sed or grep to filter output.
exec 3<>/dev/tcp/whatismyip.com/80; echo -e "GET /automation/n09230945.asp HTTP/1.0\r\nHost: whatismyip.com\r\n" >&3; a=( $(cat <&3) ); echo ${a[${#a[*]}-1]};
This is sample output - yours may be different.
This is sample output - yours may be different.
Quick write some notes to a file with cat. Ctrl+C when you have finish.
TIMEUNIT=$( cat a | grep -n "timescale" | awk -F ":" '{ print $1 } ' )
This is sample output - yours may be different.
teste.txt < cut -d : -f 1,5 /etc/passwd | tr : \\t | tr a-z A-Z | cat teste.txt
This is sample output - yours may be different.
cat private-file | gpg2 --encrypt --armor --recipient "Disposable Key" | mailx -s "Email Subject"
[email protected]
This is sample output - yours may be different.
This is a quick and easy way of encrypting files in a datastream, without ever really creating an output file from gpg. Useful with cron also, when file(s) have to be sent based on a set schedule.
for f in *.html; do head -n -1 $f > temp; cat temp > $f; rm temp; done
This is sample output - yours may be different.
Some malicious program appends a iframe or script tag to you web pages on some server, use this command to clean them in batch.