I use these command to validate twitter accounts, we can use a "for a in $(cat list.txt)" to validate a complete list of twitter accounts.
change user password one liner
This command will grep the entire directory looking for any files containing the list of files. This is useful for cleaning out your project of old static files that are no longer in use. Also ignores .svn directories for accurate counts. Replace 'static/images/' with the directory containing the files you want to search for. Show Sample Output
Sometimes "ls" is just too slow, especially if you're having problems with terminal scroll speed, or if you're a speed freak. In these situations, do an echo * in the current directory to immediately see the directory listing. Do an echo * | tr ' ' '\n' if you want a column. Do an alias ls='echo *' if you want to achieve higher echelons of speed and wonder. Note that echo * is also useful on systems that are so low in memory that "ls" itself is failing - perhaps due to a memory leak that you're trying to debug.
You can also use sha1sum and variants for longer passwords Show Sample Output
Just find out the daemon with $ netstat -atulpe. Then type in his name and he gets the SIGTERM.
Lists crontab for all users on system that have crontabs. Show Sample Output
Credit goes to "eightmillion" Show Sample Output
Add an alias to your .bashrc that allows you to issue the command xkcd to view (with gwenview) the newest xkcd comic... I know there are thousands of them out there but this one is at least replete with installer and also uses a more concise syntax... plus, gwenview shows you the downloading progress as it downloads the comic and gives you a more full featured viewing experience.
Will rot 13 whatever parameter follows 'rot13', whether it is a string or a file. Additionally, it will rot 5 each digit in a number
Nth line of a file - dirty hack way. I haven't used ed in ages ;-) Show Sample Output
Consider the following simple situation [ reading something using while and read ] [See script 1 in sample output] --------------------------------------------------- The variable var is assigned with "nullll" at first. Inside the while loop [piped while] it is assigned with "whillleeee". [Onlly 2 assignments stmts]. Outside the loop the last assigned value for "var" [and no variable] inside the while can't be accessed [Due to pipe, var is executed in a sub shell]. In these type of situation variables can be accessed by modifying as follows. [See script 2 in sample output] ___________________________ Vary helpful when reading a set of items, say file names, stored on a file [or variable] to an array an use it later. Is there any other way 2 access variables inside and outside the loop ?? Show Sample Output
_ff(){ cd /mnt; echo /mnt/*/* |sed ' s/ \/mnt\//\&/g; '|sed '/'"$1"'/!d'; cd -; } ff(){ case $# in 0) echo "usage: ff glob [sed-cmds] [--|var-name]" ;; 1) _ff $1 |sed = ;; [2-9]) case $2 in --) _ff $1 |less -SN ;; *) _ff $1 |sed -n ''"$2"''|tr '\n' '\040' |sed 's/.*/export '"$3"'=\"&/;s/=\" /=\"/;s/ $/\"/' > $HOME/.ff; case $# in 3) . $HOME/.ff ;; esac; sed ' s/export .*=\"/\$'"$3"' = \"/;' $HOME/.ff;\ ;; esac ;; esac; } v(){ local a=$HOME; sed ' s/export /less -n \$/; s/=.*//; ' $a/.ff > $a/.v ; . $a/.v ; } Another approach using ls(1) lsl(){ _lsl () { ls -l $3 /mnt/*/$1* 2>/dev/null; }; case $# in 0) echo "usage: lsl pat [ls-options|result-no]"; echo "usage: lsle pat [sed-cmds]" ;; 1) _lsl $1 |sed = ;; 2) case $2 in -*) _lsl $1 $@;; *) _lsl $1 |sed 's/.* //; '"$2"'!d; '"$2"'q' > $HOME/.lsl ; export v=$(sed 1q $HOME/.lsl); echo \$v = $v ;; esac ;; esac; } exp(){ echo "%s/\$/ /"; echo "%j"; echo "s/^/export v=\""; echo "s/\$/\""; echo "s/ \"\$/\""; echo "."; echo "wq"; } lsle(){ lsl $1 -1 |sed $2 > .lsl&& exp |ed -s .lsl >&-&& . .lsl&& echo \$v = $v; }
Read all contents from current directory and display to stdout.
Thanks to the great grml team for this func! You really should look at their shell configs for further usefull things! http://git.grml.org/?p=grml-etc-core.git;a=blob_plain;f=etc/grml/script-functions;h=4d6bcea8f9beae83abd08f44155d299ea54a4a9f;hb=HEAD # {{{ check for availability of program(s) # usage example: # check4progs [-s,-q,--quiet,--silent] arg [arg .... argn] # # with option given either of: # -s,-q,--quiet,--silent # # check for available progs but produce no output check4progs() { [ -n "${ZSH_VERSION}" ] && emulate -L sh local RTN=0 local oldifs="${IFS}" local ARG d found local VERBOSE=1 case ${1} in -q | -s | --quiet | --silent) VERBOSE=0 shift 1 ;; *) ;; esac while [ $# -gt 0 ] do ARG="$1" shift found=0 IFS=: for d in $PATH do if [ -x "${d}/${ARG}" ] then found=1 break fi done IFS="${oldifs}" # check for availability if [ ${found} -eq 0 ] then if [ ${VERBOSE} -eq 1 ] then printf "%s: binary not found\n" "${ARG}" >&2 fi RTN=1 fi done # return non zero, if at least one prog is missing! return $RTN } # }}} Show Sample Output
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: