Very simple and useful, you need to change the word "directory" for your directory
This expression looks for groups inside of a GroupOfNames class element, that is itself inside one (or many) Organizational Unit (ou) nodes in the ldap tree. Give you a quick dump of all the groups the user belongs to. Handy for displaying on a webpage. Show Sample Output
These are the parameters to ldapsearch (from ldap-utils in Ubuntu), for searching for the record for Joe Blogg's user. sAMAccountName is the LDAP field that ActiveDirectory uses to store the user name. 'DOMAIN\Joe.Bloggs' where "DOMAIN" is the the active directory domain. Othewise you could use "CN=Joe.Bloggs,DC=example,DC=com" instead of "DOMAIN\Joe.Bloggs" Show Sample Output
Place in .bashrc and invoke like this: "mecp /path/to/file", and it will copy the specified file(s) back to the desktop of the host you're ssh'ing in from. To easily upload a file from the host you're ssh'ing in from use this: ucp (){ scp ${SSH_CLIENT%% *}:Desktop/upload/* .; }
An other way to run it ( playing a random file ending with avi, flv or mpeg ) from a specified dir and a specified type of extension :
making MOVIE array with a glob :
MOVIE=( /PATH/TO/MY/FAVORITE/MOVIES/*.{avi,flv,mpeg} )
playing the random file from a random key from the array
mplayer ${MOVIE[ RANDOM % ( ${#i[@]} + 1 ) ]]}
I use only globs and a bash array.
I use GNU bash, version 3.2.48
Useful for use in other scripts for renaming, testing for extensions, etc. Show Sample Output
I did not know this, i'd like to share...
Leave it to a proprietary software vendor to turn a cheap and easy parlor trick into a selling point. "Hey guys, why don't we turn our _collection of multiple files_ into a *collection of multiple files*!!" Extract the ^above with this:
cat pics.tar.gz.??? | tar xzv
^extract on any Unix - no need to install junkware!
(If you must make proprietary software, at least make it do something *new*)
if [ -e windows ]; then use 7-Zip
Fir3net.com
This shell snippet reads a single keypress from stdin and stores it in the $KEY variable. You do NOT have to press the enter key! The key is NOT echoed to stdout! This is useful for implementing simple text menus in scripts and similar things.
This command use vnc to connect to another computer and emulate an dual-screen enviroment.
Example of use:
x2vnc -west 192.168.0.100:0
After this, if vnc server needs an password, will be prompt in the shell.
p.s.: sorry my english
Possible use, to filter something in stderr: (/usr/bin/$COMMAND $PARAM 3>&1 1>&2 2>&3 | grep -v $uninteresting_error ) 3>&1 1>&2 2>&3
ncdu is a text-mode ncurses-based disk usage analyzer. Useful for when you want to see where all your space is going. For a single flat directory it isn't more elaborate than an du|sort or some such thing, but this analyzes all directories below the one you specify so space consumed by files inside subdirectories is taken into account. This way you get the full picture. Features: file deletion, file size or size on disk and refresh as contents change. Homepage: http://dev.yorhel.nl/ncdu Show Sample Output
^Hexadecimal Ten minus Octal Ten is Eight(in Decimal).
echo "$(( 0xaf )) = $(( 0257 ))"
^Hexadecimal AF and Octal 257 are both Decimal 175.
Show Sample Output
Here the pattern is '*.jar', you could pass in any pattern. Another, maybe nicer way to do this is http://www.commandlinefu.com/commands/view/1921/summarise-the-size-of-all-files-matching-a-simple-regex You could replace sed with tr Show Sample Output
w3m is a commanline web browser, full of options, I used -dump_head for less unnecessary page download. With awk, I can retrieve dynamic changes in webpages in this very econnomical fashion Show Sample Output
Uses htmldoc to perform the conversion
evento.sh needed for awk syntax the aplay command makes a camera sound. It takes a picture of who looked at the display #!/bin/bash # evento.sh: deteta evento e fala awk '{print}' | espeak -v pt -stdin awk '/e/{print "emergencia"}' | espeak -v pt -stdin aplay -q /home/mm/bash/camera.wav # -q inibe verbose do comand aplay exit 0
Speaks whatever comes in via stdin (-v pt = portuguese, default = englisg) ..speech part of keyboard event talker. Made to accomplish a simple alarm central based on a cheap keyboard circuit. This way I have one zone per direct keypress. Depends on keypress.sh. It speaks out loud wich zone (key) has been pressed ( faulted ). Here is keypress.sh : #!/bin/bash # keypress.sh: Detect a user keypress ("hot keys"). echo old_tty_settings=$(stty -g) # Save old settings (why?). stty -icanon Keypress=$(head -c1) # or $(dd bs=1 count=1 2> /dev/null) # on non-GNU systems aplay -q /home/mm/bash/beep-1.wav echo echo "Chamada quarto \""$Keypress"\"." echo stty "$old_tty_settings" # Restore old settings. # Thanks, Stephane Chazelas. exit 0
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.
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
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: