Jump to content

User:Int 80h/commands

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Int 80h (talk | contribs) at 20:05, 3 October 2016 (Useful Commands (and their options and switches)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Useful Commands (and their options and switches)

  • rsync -aPEmivvz <src_dir> <dst_dir>
    Actually good copying without huge suckage!
  • latexmk -xelatex -interaction=nonstopmode -synctex=1 -pv <latex.tex>
    Sensible LaTeX compiling.
  • ssh <user>@<host> -L 0.0.0.0:<loc_port>:<host>:<host_port>
    Create a sensible port forwarding to a host, that's sitting behind a firewall, where SSH is the only way to get access to. <loc_port> is the ports on the machine you're SSH-ing from. <host_port> is the port on the <host> that we're trying to forward to.
  • ssh <user>@<host> -XY
    Make X forwarding work, even when the Admins are idiots.
  • netstat -alptune
    Useful and grep-able netstat output.
  • xz -9ve <file>
    Very high compression if you want to feel really special.
  • mplayer -ass -embeddedfonts <video>
    mplayer with embedded subtitle fonts, and everything...
  • gm convert -density 150 -type GrayScaleMatte <document.pdf> -trim <image.png>
    Convert a PDF to PNG.
  • mkisofs -J -l -r -f -allow-lowercase -allow-leading-dots -A "<friendly name>" -V "<vol_name>" -o <file.iso> [<files>|<directories>]
    Create standard data CD ISO. Optional -iso-level [1234].
  • dd if=/dev/zero of=<file> count=0 seek=<blocknum>
    Quickly make an empty file. Optional bs=<size>.
  • ffmpeg -f rawvideo -pix_fmt yuv420p -s:v <width>x<heigh> -r <framerate> -i input.yuv -c:v libx265 -preset veryslow -x265-params crf=15 out.mkv
    Convert uncompressed video using h.265 (HEVC). crf selects quality, goes from 0 (highest) to 51. -preset has various settings, file becomes smaller, the slower the process.
  • pacmd list-sources
    Print all attached audio devices to pulseaudio.
  • pactl load-module module-loopback latency_msec=1
    Load module to playback input straight through to an output device.
  • setxkbmap -option compose:menu
    Set Menu key to be compose, no matter the keyboard mapping.
  • setxkbmap -layout us -variant altgr-intl -option compose:menu
    Set keyboard mapping to US-AltGr-Intl with a Compose key.
  • ffmpeg -i <input.mp4> -c copy -metadata:s:v:0 rotate=<deg> <output.mp4>
    Rotates a video by altering meta data. This doesn't work universally, but it beats recoding the video.
Network monitoring

(WIP) nload, iftop, iptraf, nethogs, bmon, slurm, tcptrack, vnstat, bwm-ng, cbm, speedometer, pktstat, netwatch, trafshow, netload, ifstat, dstat, collectl

Pandoc

  • pandoc <input.md> -o <output.html> -s -S -i --toc --html-q-tags -m {-c <opt.css>} {-H <header.html>} -f markdown+tex_math_single_backslash -t html5 --normalize --highlight-style tango
    Pretty much basic and general setup. Assumes additional setup in header files. KaTeX has to be set up via tailored header files.
  • pandoc <input.md> -o <output.html> -s -S -i --toc --html-q-tags --mathjax=res/MathJax/MathJax.js\?config=TeX-AMS-MML_HTMLorMML {-c <opt.css>} {-H <header.html>} -f markdown+tex_math_single_backslash -t html5 --normalize --highlight-style tango
    Local MathJax installation.

Compiler stuff

  • CPPFLAGS="-I$HOME/include" LDFLAGS="-L$HOME/lib" PKG_CONFIG_PATH="$HOME/include/pkgconfig" make
    run make for something that needs local libs. Also works for ./configure

Windows

  • reg add "HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout" /v "Scancode Map" /t REG_BINARY /d "00000000000000000300000001003A003A00010000000000" /f
    make CapsLock be Escape. Good for Vim and such.
  • reg add HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont /v "00" /t REG_SZ /d "Consolas" /f
    Add Consolas as general purpose font for the Console.

Fonts

  •  mkfontdir <directory>
     xset fp+ <directory>
     xset fp rehash
    

This makes PCF fonts available in X. A fonts.alias can be placed in the directory for font name aliases.

  • fc-cache -vf
    Re-read fontconfig directories.

XFCE autostart

When starting applications automatically on logon (Settings > Session and Startup > Application Autostart), XFCE seems to be rather picky about a few things. Here are the workarounds and bodges.

  • /bin/sh -c "sleep 5"; xmodmap ~/.Xmodmap"
    this applies custom .Xmodmap settings after logging in, gracefully. Otherwise XFCE does whatever it feels like with this...