Linux CLI commands I Cannot Remember...

From wiki.N4VX.net
Jump to navigation Jump to search

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
another weather - curl wttr.in/AVL
price of $BTC - curl rate.sx/BTC or add a time span curl rate.sx/BTC@30d

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
  • reload .bashrc . ~/.bashrc


  • Convert vertically shot video (I secretly hate you) to proper 16x9 format with "echo pillarboxing" effect on the sides. Ok, it's not a secret. I hate you for vertical video.
ffmpeg -i input.mp4 -vf 'split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' output.mp4 
  • Turn a multi-page pdf into a single page pdf
pdftk full-pdf.pdf cat 1 output outfile_page1.pdf

More than commands...

Add swap space in Ubuntu 18.04LTS


Scan and check USB drives



Bypass CGNAT(NAT444) with Wireguard and a VPS


Batch transcode .wma to .mp3


Add Alby support to Azuracast Public Page

docker exec -t $YOUR_AZURACAST_CONTAINER /bin/bash
nano /var/azuracast/www/templates/frontend/public/index.phtml

add the line below in the appropriate place with all the other <meta blah blah> tags

<meta name="lightning" content="lnurlp:$YOUR_ALBY_NAME@getalby.com" />

Boom!!

Update Umbrel from CLI

sudo ./PATHTOUMBREL/scripts/update --repo getumbrel/umbrel

Mosquitto MQTT Broker with Docker Compose

Directions Here

Add font to ubuntu

Many fonts are packaged for Ubuntu and available via the "Fonts" category of the Ubuntu Software Center. If you prefer apt-get, search for packages starting with otf- or ttf-. Font files that are placed in the hidden .fonts directory of your home folder will automatically be available (but /etc/fonts/fonts.conf indicates it will be removed soon.). You can also place them in the ~/.local/share/fonts directory on newer versions of Ubuntu per the comments below. You can also double-click on the font file (or select Open with Font Viewer in the right-click menu). Then click the Install Font button. If you need the fonts to be available system-wide, you'll need to copy them to /usr/local/share/fonts and reboot (or manually rebuild the font cache with fc-cache -f -v). You can confirm they are installed correctly by running fc-list | grep "<name-of-font>" You may need to restart some programs, like OpenOffice Writer, before they actually show the new fonts (usually such programs are caching the font list when they start up). Edit: Changed advice to manually install into /usr/local/share/fonts instead of /usr/share/fonts to reflect comments and best practice.