Commands by shawn_abdushakur (24)

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"

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"

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)
This creates an archive that does the following: rsync:: (Everyone seems to like -z, but it is much slower for me) -a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files. -H: preserves hard-links -A: preserves ACLs -X: preserves extended attributes -x: don't cross file-system boundaries -v: increase verbosity --numeric-ds: don't map uid/gid values by user/group name --delete: delete extraneous files from dest dirs (differential clean-up during sync) --progress: show progress during transfer ssh:: -T: turn off pseudo-tty to decrease cpu load on destination. -c arcfour: use the weakest but fastest SSH encryption. Must specify "Ciphers arcfour" in sshd_config on destination. -o Compression=no: Turn off SSH compression. -x: turn off X forwarding if it is on by default. Flip: rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" [source_dir] [dest_host:/dest_dir]

Backup (archive) your Gmail IMAP folders.
Copies an entire hierarchy of mailboxes from the named POP3/IMAP/etc. source to the named destination. Mailboxes are created on the destination as needed. NOTE: The 'mailutil' is Washington's University 'mailutil' (apt-get install uw-mailutils). More examples $ mailutil transfer {}INBOX Gmail/ ; mailutil check}\[Gmail\]/Spam If you use the utility in the first, append -v|-d flag(s) to the end the commands above (man mailutil).

How to trim a video using ffmpeg
Will trim the video to 4 seconds starting from the beginning. The -vcodec , -acodec options are required so that ffmpeg knows in what video/audio format you want for the new video.

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Find all files with colons and replace with underscores; current directory and below (recursive).

Display EPOCH time in human readable format using AWK.

Convert tab separate file (TSV) to JSON with jq
With this command you can convert a tab separate file (TSV) into a JSON file with jq. For example, this input.tsv i-0b9adca882e5e6326 i-088dd69e5c3624888 i-0e70eac180537d4aa will produce the showed output.

Clean all .pyc files from current project. It cleans all the files recursively.

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: