Commands by qcjn (3)

  • Put this logging function in you're script, when need it call it. command || logme "Error with command"


    0
    logme(){ echo "$(date +%d-%m-%Y-%H:%M) => $0 @ $1 returned error" >> persoscript.log }
    qcjn · 2013-10-22 15:55:01 0
  • This will create rapidly an html menu. You can paste it in you're html page with the middle button(the wheel). I didn't test it in an html with css, but it seems alright. Show Sample Output


    -1
    for menu in {1..4}; do echo -e "<ul>\n <li>menu $menu</li>\n <ul>"; for items in {1..5}; do echo " <li>item $items</li>"; if [ $items -eq 5 ];then echo -e " </ul>";fi;done; echo "</ul>";done | xclip
    qcjn · 2013-09-22 06:34:32 0
  • you can put almost any command. notify-send -t 0 "MOTD" "$(sed -n '/#^4/,/#$4/{/#^4\|#$4/!p}' motd2 | cut -d# -f2)" notify-send -t 0 "readfile" "$(while read mess; do echo $mess;done < motd2)"


    3
    notify-send -t 5000 "date" "$(date)"
    qcjn · 2013-08-27 03:15:14 0

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

Find the package that installed a command

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)

Recursively remove Mac . (dot) files
Searches from present dir forward and removes all Mac generated . (dot) files.

unpack all rars in current folder

Get the size of all the directories in current directory

GZip all files in a directory separately

Install pip with Proxy
Installs pip packages defining a proxy

view the system memory in clear text
see what's in your memory right now... sometimes you find passwords, account numbers and url's that were recently used. Anyone have a safe command to clear the memory without rebooting?

suspend to ram without root
$dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

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


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: