Commands tagged progress (27)

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

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Place the argument of the most recent command on the shell
This works if your terminal is in Vi mode

Simple server which listens on a port and prints out received data
Sometimes you need a simple server which listens on a port and prints out received data. Example: Consider you want to know, which data is posted by a homepage to a remote script without analysing the html code! A simple way to do this is to save the page to your computer, substitude all action="address" with action="localhost:portnumber", run 'ncat -l portnumber' and open the edited page with your browser. If you then submit the form, ncat will print out the http-protocol with all the posted data.

Show numerical values for each of the 256 colors in bash
Same as, but for bash. This will show a numerical value for each of the 256 colors in bash. Everything in the command is a bash builtin, so it should run on any platform where bash is installed. Prints one color per line. If someone is interested in formatting the output, paste the alternative.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Bash scripts encryption and passphrase-protection
This function will encrypt a bash script and will only execute it after providing the passphrase. Requires mcrypt to be installed on the system. $ cat hello #!/bin/bash case "$1" in ""|-h) echo "This is the fantastic Hello World. Try this:" $(basename $0) "[entity]" ;; moon) echo Good night. ;; sun) echo Good morning. ;; world) echo "Hello, world!" ;; *) echo Hi, $@. ;; esac $ scrypt hello Enter the passphrase (maximum of 512 characters) Please use a combination of upper and lower case letters and numbers. Enter passphrase: Enter passphrase: Stdin was encrypted. $ cat hello.scrypt . <(echo "$(/usr/bin/tail -n+2 $0|base64 -d|mcrypt -dq)");exit; AG0DQHJpam5kYWVsLTEyOAAgAGNiYwBtY3J5cHQtc2hhMQAV34412aaE8sRzQPQzi09YaNQPedBz aGExAARvB6A/HYValW4txoCFmrlp57lmvhKBbM4p+OUiZcCxr6Y+Mm7ogg3Y14pHi0CrfT70Tubq 9g8/kNJrQr7W/ogHpVuOOdD0YfuRatrV7W2+OlNQ63KX780g4qTHrTqNnyLp8sF5RQ7GwxyZ0Oti kROtVIU4g4+QAtn/k/e7h7yt4404VF1zzCYRSw20wmJz1o/Z0XO7E/DFBr5Bau7bWjnF7CRVtims HGrDwv1miTtAcyB9PknymDxhSyjDUdNhqXGBIioUgqjX1CKgedtO0hQp050MiQd3I6HacpSrVUIW kuuS+BtMrxHDy+48Mh1hidV5JQFP7LP5k+yAVLpeHd2m2eIT1rjVE/Bp2cQVkpODzXcWQDUAswUd vulvj/kWDQ== $ ./hello This is the fantastic Hello World. Try this: hello [entity] $ ./hello.scrypt Enter passphrase: This is the fantastic Hello World. Try this: hello.scrypt [entity] $ ./hello world Hello, world! $ ./hello.scrypt world Enter passphrase: Hello, world!

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

Recursively unrar into dir containing archive
From the cwd, recursively find all rar files, extracting each rar into the directory where it was found, rather than cwd. A nice time saver if you've used wget or similar to mirror something, where each sub dir contains an rar archive. Its likely this can be tuned to work with multi-part archives where all parts use ambiguous .rar extensions but I didn't test this. Perhaps unrar would handle this gracefully anyway?

Switch 2 characters on a command line.
If you typed 'sl', put the cursor on the 'l' and hit ctrl-t to get 'ls'.

Remove security limitations from PDF documents using ghostscript (for Windows)
#4345 also works under windows

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: