Difference between revisions of "Linux CLI commands I Cannot Remember..."

From wiki.N4VX.net
Jump to navigation Jump to search
Line 13: Line 13:
  
 
===CLI Commands with some useful syntax===
 
===CLI Commands with some useful syntax===
* list the fingerprint of key <code>ssh-keygen -lf ~/.ssh/id_rsa.pub </code>
+
* list the fingerprint of key  
 +
ssh-keygen -lf ~/.ssh/id_rsa.pub
 
*parse fail2ban logs
 
*parse fail2ban logs
 
#<code>cat /var/log/fail2ban.log | grep Ban | awk '{print $6,$7,$1,$2}' | uniq </code><br>
 
#<code>cat /var/log/fail2ban.log | grep Ban | awk '{print $6,$7,$1,$2}' | uniq </code><br>
 
#<code>sudo cat fail2ban.log | grep Ban | awk '{print $8}' | sort | uniq -c </code><br>
 
#<code>sudo cat fail2ban.log | grep Ban | awk '{print $8}' | sort | uniq -c </code><br>
 
#<code>sudo cat /var/log/fail2ban.log | grep Ban | awk '{print $8,$7}' | sort | uniq -c </code><br>
 
#<code>sudo cat /var/log/fail2ban.log | grep Ban | awk '{print $8,$7}' | sort | uniq -c </code><br>
* useless waste of time and peta-flops <code>cat /dev/urandom | hd | grep "ca fe"</code>
+
* useless waste of time and peta-flops  
 +
cat /dev/urandom | hd | grep "ca fe"
 
*Scrape 1FC data from RadioReference
 
*Scrape 1FC data from RadioReference
** parse RadioReference.com 1FC data from website and save CCs to list <code><nowiki> wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | sed 's/[a-zA-Z<>="\/: #-]/ /g' | grep "[7,8][5,6,7][0-9].[0-9][0-9][0-9][0-9][0-9]c" | awk '{ print $6 }' > 1fc.cc </nowiki></code>
+
** parse RadioReference.com 1FC data from website and save CCs to list  
**or the new version <code><nowiki>wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | grep '[7,8][0-9][0-9].[0-9]\+c' | sed 's/[><]/ /g' | awk '{print $6}' | sort -un > 1fc.cc && wc -l 1fc.cc >> 1fc.cc && cat 1fc.cc | sed 's/1fc.cc/Control Channels/g' > 1fc.txt && cat 1fc.txt</nowiki></code>
+
wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | sed 's/[a-zA-Z<>="\/: #-]/ /g' | grep "[7,8][5,6,7][0-9].[0-9][0-9][0-9][0-9][0-9]c" | awk '{ print $6 }' > 1fc.cc
 +
**or the new version  
 +
wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | grep '[7,8][0-9][0-9].[0-9]\+c' | sed 's/[><]/ /g' | awk '{print $6}' | sort -un > 1fc.cc && wc -l 1fc.cc >> 1fc.cc && cat 1fc.cc | sed 's/1fc.cc/Control Channels/g' > 1fc.txt && cat 1fc.txt
  
** parse the 1fc.html data for ALL freqs in use <code><nowiki>cat 1fc.html | grep "[7,8][0-9][0-9].[0-9][0-9][0-9][0-9][0-9]" | sed 's/[a-zA-Z<>="\/: #-]//g' > 1fc.all</nowiki></code><br>
+
** parse the 1fc.html data for ALL freqs in use  
* read the "p" text in a news webpage <code><nowiki>cat index.html | grep '<p>' | sed 's/<[^<>]*>//g' | sed 's/[^>]*>//g' | sed 's/<[^<]*//g' | sed 's/MORE//g' | festival --tts</nowiki></code><br>
+
cat 1fc.html | grep "[7,8][0-9][0-9].[0-9][0-9][0-9][0-9][0-9]" | sed 's/[a-zA-Z<>="\/: #-]//g' > 1fc.all<br>
* working outbound mail CLI <code>cat /var/log/apache2/error.log | mail -s "Apache Error Logs" mail@domain.tld</code><br>
+
* read the "p" text in a news webpage  
 +
cat index.html | grep '<nowiki><p></nowiki>' | sed 's/<[^<>]*>//g' | sed 's/[^>]*>//g' | sed 's/<[^<]*//g' | sed 's/MORE//g' | festival --tts<br>
 +
* working outbound mail CLI  
 +
cat /var/log/apache2/error.log | mail -s "Apache Error Logs" mail@domain.tld<br>
 
* open udp ports for chromecast <code>iptables -I INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT</code><br>
 
* open udp ports for chromecast <code>iptables -I INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT</code><br>
 
* working RTL-SDR ADS-B webserver <code>$PATH/dump1090 --raw --net --net-http-port 8008 & mono $PATH/VirtualRadar.exe</code><br>
 
* working RTL-SDR ADS-B webserver <code>$PATH/dump1090 --raw --net --net-http-port 8008 & mono $PATH/VirtualRadar.exe</code><br>

Revision as of 19:56, 3 January 2021

Random CLI Commands

htop - graphical process monitor
iptraf - graphical IP traffic monitor
meshmap - HSMM mesh map generator
figlet - make ASCII letters
chirpw - radio programming
camgrab - CLI webcam pic grabber
pwgen - password generator
links2 - ncurses web browser
inxi -Fx - System information
weather - cli weather info
telnet rainmaker.wunderground.com

CLI Commands with some useful syntax

  • list the fingerprint of key
ssh-keygen -lf ~/.ssh/id_rsa.pub
  • parse fail2ban logs
  1. cat /var/log/fail2ban.log | grep Ban | awk '{print $6,$7,$1,$2}' | uniq
  2. sudo cat fail2ban.log | grep Ban | awk '{print $8}' | sort | uniq -c
  3. sudo cat /var/log/fail2ban.log | grep Ban | awk '{print $8,$7}' | sort | uniq -c
  • useless waste of time and peta-flops
cat /dev/urandom | hd | grep "ca fe"
  • Scrape 1FC data from RadioReference
    • parse RadioReference.com 1FC data from website and save CCs to list
wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | sed 's/[a-zA-Z<>="\/: #-]/ /g' | grep "[7,8][5,6,7][0-9].[0-9][0-9][0-9][0-9][0-9]c" | awk '{ print $6 }' > 1fc.cc  
    • or the new version
wget -O 1fc.html http://www.radioreference.com/apps/db/?sid=7118 && cat 1fc.html | grep '[7,8][0-9][0-9].[0-9]\+c' | sed 's/[><]/ /g' | awk '{print $6}' | sort -un > 1fc.cc && wc -l 1fc.cc >> 1fc.cc && cat 1fc.cc | sed 's/1fc.cc/Control Channels/g' > 1fc.txt && cat 1fc.txt
    • parse the 1fc.html data for ALL freqs in use
cat 1fc.html | grep "[7,8][0-9][0-9].[0-9][0-9][0-9][0-9][0-9]" | sed 's/[a-zA-Z<>="\/: #-]//g' > 1fc.all
  • read the "p" text in a news webpage
cat index.html | grep '<p>' | sed 's/<[^<>]*>//g' | sed 's/[^>]*>//g' | sed 's/<[^<]*//g' | sed 's/MORE//g' | festival --tts
  • working outbound mail CLI
cat /var/log/apache2/error.log | mail -s "Apache Error Logs" mail@domain.tld
  • open udp ports for chromecast iptables -I INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT
  • working RTL-SDR ADS-B webserver $PATH/dump1090 --raw --net --net-http-port 8008 & mono $PATH/VirtualRadar.exe
  • modify file timestamp touch -t YYYYMMDDHHMM filename.ext
  • rename images by their EXIF timestamp exiv2 -r'%Y%m%d_%H%M%S' -F *.JPG and exiv2 -r'%Y%m%d_%H%M%S_COMMENT_STUFF' -F *.JPG
  • EAS decoder multimon-ng -a EAS -t wav $FILE
  • rtl-fm play audio localy broadcast FM rtl_fm -g 50 -f 99.9M -M wfm -s 180k -E deemp | play -r 180k -t raw -e s -b 16 -c 1 -V1 - lowpass 16k
  • lock screen rotation in Ubuntu 18.04 on HP ProBook 6560b gsettings set org.gnome.settings-daemon.plugins.orientation active false
  • imagemagick perspective with tiling convert flag.jpg -virtual-pixel tile -distort Perspective '0,0 30,55 2121,0 917,35 0,1414 55,1111 2121,1414 820,707' flagA.jpg
  • imagemagick add watermark/overlay with opacity convert flagA.jpg -resize 1024x1024 miff:- | composite -dissolve 37% -gravity center overlay.png - overlayflag.png
  • convert .mov to .mp4 with ffmpeg - ffmpeg -i my-video.mov -vcodec h264 -acodec mp2 my-video.mp4

More than commands...