Force the user you want to watch doing things into doing his things in a screen session. Then simply attach yourself to that session with the command shown above. Works only if you are on the same machine, of course
Opens a file or URL in the user's preferred application.
OS: Debian based (or those that use dpkg) Equivalent to doing a dpkg -S on each file in $PATH, but way faster. May report files generated though postinstall scripts and such. For example . It will report /usr/bin/vim .. which is not not a file installed directly by dpkg, but a link generated by alternatives hooks
Connect to a machine running ssh using mac address by using the "arp" command Show Sample Output
Removes trailing newline; colon becomes record separator and newline becomes field separator, only the first field is ever printed. Replaces empty entries with $PWD. Also prepend relative directories (like ".") with the current directory ($PWD). Can change PWD with env(1) to get tricky in (non-Bourne) scripts. Show Sample Output
This version uses Pipes, but is easier for the common user to grasp... instead of using sed or some other more complicated method, it uses the tr command Show Sample Output
A x509 certificate and a rsa key file have in common a parameter called modulus, it is a very long hexadecimal number. That value is unique for each certficate / key pair. The command allows to do the check of this pair of values in a script using a great feature of bash. " Show Sample Output
This is really fast :)
time find . -name \*.c | xargs wc -l | tail -1 | awk '{print $1}'
204753
real 0m0.191s
user 0m0.068s
sys 0m0.116s
Show Sample Output
Ripping VCD in Linux
When using reverse-i-search you have to type some part of the command that you want to retrieve. However, if the command is very complex it might be difficult to recall the parts that will uniquely identify this command. Using the above trick it's possible to label your commands and access them easily by pressing ^R and typing the label (should be short and descriptive). UPDATE: One might suggest using aliases. But in that case it would be difficult to change some parts of the command (such as options, file/directory names, etc).
This command gives you the charset of a text file, which would be handy if you have no idea of the encoding. Show Sample Output
Checks the Gmail ATOM feed for your account, parses it and outputs a list of unread messages.
For some reason sed gets stuck on OS X, so here's a Perl version for the Mac:
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)<\/title>.*<name>(.*)<\/name>.*$/$2 - $1/'
If you want to see the name of the last person, who added a message to the conversation, change the greediness of the operators like this:
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)<\/title>.*?<name>(.*?)<\/name>.*$/$2 - $1/'
Show Sample Output
creates a compressed tar archive of files in /path/foo and writes to a timestamped filename in /path.
Use tar command for a backup info with a date of creation Show Sample Output
alias ps?='psg' for maximum hawtness. Works in bash or zsh. Show Sample Output
Shell timeout variables (TMOUT) can be very liberal about what is classified as 'activity', like having an editor open. This command string will terminate the login shell for an user with more than a day's idle time.
From there, just pkg install the package you need. Show Sample Output
This finds all the PowerPC apps recognized by OS X.
A better version is:
system_profiler SPApplicationsDataType 2> /dev/null | perl -
wnl -e '$i=$j=$k=$p=0; @al=; $c=@al; while($j
s[$i].=$al[$j]; $i++ if ($al[$j]) =~ /^\s\s\s\s\S.*:$/; $j++} while($k
apps[$k++]; if (/Kind: PowerPC/s) {print; $p++;}} print "$i applications, $p P
owerPC applications\n\n"'
but that is more than 255 characters...
Lists out all classes used in all *.html files in the currect directory. usefull for checking if you have left out any style definitions, or accidentally given a different name than you intended. ( I have an ugly habit of accidentally substituting camelCase instead of using under_scores: i would name soemthing counterBox instead of counter_box) WARNING: assumes you give classnames in between double quotes, and that you apply only one class per element.
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: