Commands by malathion (20)

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


    -1
    ffmpeg -i in.mov -vf "transpose=1" out.mov
    malathion · 2019-09-02 04:54:31 32

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

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


    1
    pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no
    malathion · 2019-07-14 02:54:59 32
  • 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: https://github.com/stedolan/jq/issues/1110


    3
    diff <(jq . -M -S < old.json) <(jq . -M -S < new.json)
    malathion · 2018-10-11 20:59:48 120
  • 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 https://stedolan.github.io/jq/download/ This alternative to the original avoids the useless use of cat Show Sample Output


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

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

  • 1
    echo "http://commandlinefu.com" | curl -F-=\<- qrenco.de
    malathion · 2017-06-22 22:27:16 11
  • Replace 'csv_file.csv' with your filename.


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


    5
    !!:s/foo/bar/
    malathion · 2016-07-25 18:52:42 10
  • 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: https://web.archive.org/web/20130929001850/http://linuxnote.net/jianingy/en/linux/a-fast-way-to-remove-huge-number-of-files.html


    11
    rsync -a --delete empty-dir/ target-dir/
    malathion · 2016-06-07 16:56:55 7
  • If this command prints 'x' then your shell is vulnerable. Null output confirms that you are protected. Further reading: http://allanmcrae.com/2014/09/shellshock-and-arch-linux/ Show Sample Output


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


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


    4
    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 4
  • 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.


    4
    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 5
  • 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


    0
    psql -X -A -t -c "SELECT version();"
    malathion · 2014-05-01 18:10:20 4
  • 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


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

  • 2
    nvidia-settings -q gpucoretemp -t | awk '{s+=$1}END{print s/NR}' RS=" "
    malathion · 2014-01-16 17:24:09 7
  • 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


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


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

What's this?

commandlinefu.com 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

Nginx - print all optional modules before compilation
wget http://nginx.org/download/nginx-1.15.3.tar.gz && tar -xzf 1.15.3.tar.gz && cd nginx-1.15.3

create shortcut keys in bash

set history file length
set how many commands to keep in history Default is 500 Saved in /home/$USER/.bash_history Add this to /home/$USER/.bashrc HISTFILESIZE=1000000000 HISTSIZE=1000000

list block devices
Shows all block devices in a tree with descruptions of what they are.

mplayer -vo aa foo.mpg
mplayer -vo caca will give you a similar result but in color

Download Entire YouTube Channel - all of a user's videos
create the function then run 'yt-chanrip username' to download that user's entire channel. uses youtube-dl and the GData API. similar to http://www.commandlinefu.com/commands/view/3154/download-youtube-playlist

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

check open ports without netstat or lsof

Get all ip address for the host

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"


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: