Commands by malathion (20)

  • Transpose parameter: 0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical Flip

    ffmpeg -i -vf "transpose=1"
    malathion · 2019-09-02 04:54:31 0

  • 1
    convmv --lower --notest FILE
    malathion · 2019-08-20 05:28:08 0

  • 2
    sysctl machdep.xcpm.cpu_thermal_level
    malathion · 2019-08-19 21:15:07 0
  • pudb is an ncurses debugger. This command will allow interactive debugging of test failures in pytest using pudb.

    pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no
    malathion · 2019-07-14 02:54:59 0
  • jq is amazing for manipulating json on the commandline, but the developers have some weird ideas about how to handle shell redirections. This command works around them. Further reading:

    diff <(jq . -M -S < old.json) <(jq . -M -S < new.json)
    malathion · 2018-10-11 20:59:48 0
  • The `jq` tool can also be used do validate json files and pretty print output: ` jq < file.json` Available on several platforms, including newer debian-based systems via `#sudo apt install jq`, mac via `brew install jq`, and from source This alternative to the original avoids the useless use of cat Show Sample Output

    jq < file.json
    malathion · 2018-10-03 18:46:46 8

  • 0
    obase=16; echo "$(date +%s)" | bc | xxd -r -p | base32
    malathion · 2017-06-26 16:58:38 6

  • 1
    echo "" | curl -F-=\<-
    malathion · 2017-06-22 22:27:16 0
  • Replace 'csv_file.csv' with your filename.

    python -c "import csv,json;print json.dumps(list(csv.reader(open('csv_file.csv'))))"
    malathion · 2017-05-17 19:35:53 1
  • Replaces the first instance of 'foo' with 'bar'. To replace all instances of 'foo' with 'bar': !!:gs/foo/bar/

    malathion · 2016-07-25 18:52:42 0
  • This command works by rsyncing the target directory (containing the files you want to delete) with an empty directory. The '--delete' switch instructs rsync to remove files that are not present in the source directory. Since there are no files there, all the files will be deleted. I'm not clear on why it's faster than 'find -delete', but it is. Benchmarks here:

    rsync -a --delete empty-dir/ target-dir/
    malathion · 2016-06-07 16:56:55 1
  • If this command prints 'x' then your shell is vulnerable. Null output confirms that you are protected. Further reading: Show Sample Output

    x="() { :; }; echo x" bash -c :
    malathion · 2014-12-08 22:21:18 0
  • echo "Hello world!" | sprunge # Redirect a stream to a pastebin sprunge ~/.bashrc # Send a file to a pastebin

    sprunge() { curl -F 'sprunge=<-' < "${1:-/dev/stdin}"; }
    malathion · 2014-08-26 17:47:31 1
  • Without the bashisms and unnecessary sed dependency. Substitutions quoted so that filenames with whitespace will be handled correctly.

    for file in *.pdf; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 "$file" "${file//.pdf/.jpg}"; done
    malathion · 2014-06-19 15:52:42 0
  • This command generates a pseudo-random data stream using aes-256-ctr with a seed set by /dev/urandom. Redirect to a block device for secure data scrambling.

    openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero > randomfile.bin
    malathion · 2014-06-02 18:12:54 1
  • Without using a pipe. -X ignores the user's .psqlrc configuration file -A sets un-aligned table output mode -t prints rows only (no headers or footers) Show Sample Output

    psql -X -A -t -c "SELECT version();"
    malathion · 2014-05-01 18:10:20 1
  • In this example I am returning all the files in /usr/bin that weren't put there by pacman, so that they can be moved to /usr/local/bin where they (most likely) belong. Show Sample Output

    for file in /usr/bin/*; do pacman -Qo "$file" &> /dev/null || echo "$file"; done
    malathion · 2014-04-22 21:57:08 0

  • 2
    nvidia-settings -q gpucoretemp -t | awk '{s+=$1}END{print s/NR}' RS=" "
    malathion · 2014-01-16 17:24:09 0
  • Routes curl input through a local SOCKS5 proxy; in this case, anonymizes curl activity via The Onion Router (Tor) proxy running locally. Note that the traffic will be anonymized, but it will NOT be encrypted, so your traffic will be very vulnerable to man-in-the-middle attacks. Show Sample Output

    turl(){ curl --socks5-hostname localhost:9050 [email protected] ; }
    malathion · 2013-07-12 17:09:16 1
  • libpurple likes to hardlink files repeatedly. To ignore libpurple, use sed: | sed '/\.\/\.purple/d' Show Sample Output

    find . -type f -a \! -links 1
    malathion · 2013-05-06 20:44:08 1

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

check open ports without netstat or lsof

List all accessed configuration files while executing a program in linux terminal (improved version)
Last listed files presumably have higher precedency then files listed first, i.e. configuration files in the personal .config directory will be listed last and their config parameters will be more authoritative then default config parameters defined in /etc directory which are usually listed above them. If you replace ".conf" with ".ini" in the command, initial files will be listed instead of config files. If you do not like to list multiple access to the same config file, pipe to "uniq" or "uniq -c" to prefix lines by the number of occurrences

delete files containing matching text
-r recursively -Z zero byte after each file name instead of the usual newline -l only filenames

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

Ad blocking on Ubuntu phone/tablet with hosts file
Will append lines to the hosts file to do some basic ad blocking.

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

Determine an image's dimensions
Simple use of ImageMagick identify function.

Backup files older than 1 day on /home/dir, gzip them, moving old file to a dated file.
Useful for backing up old files, custom logs, etc. via a cronjob.

Export a directory to all clients via NFSv4, read/write.
This exports a directory to the world in read/write mode. It is useful for quick, temporary NFS exports. Consider restricting the clients to a subnet or to specific hosts for security reasons (the client can be specified before the colon). On the client: mount -t nfs4 hostname:/ /mountpoint To terminate all of the exports (after unmounting on the client): exportfs -u -a Leave out the fsid=0 option if you don't want NFSv4. This works under recent versions of Linux.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: