this requires the use of a throwaway file. it outputs a shell function. assuming the throwaway file is f.tmp usage: >f.tmp;lso f.tmp > f.tmp; . f.tmp;rm f.tmp;lso -l ... notes: credit epons.org for the idea. however his version did not account for the sticky bit and other special cases. many of the 4096 permutations of file permissions make no practical sense. but chmod will still create them. one can achieve the same sort of octal output with stat(1), if that utility is available. here's another version to account for systems with seq(1) instead of jot(1): lso(){ case $# in 1) { case $(uname) in FreeBSD) jot -w '%04d' 7778 0000 7777 ;; *) seq -w 0000 7777 ;; esac; } \ |sed ' /[89]/d s,.*,printf '"'"'& '"'"';chmod & '"$1"';ls -l '"$1"'|sed s/-/./,' \ |sh \ |{ echo "lso(){"; echo "ls \$@ \\"; echo " |sed '"; sed ' s, ,@,2; s,@.*,,; s,\(.* \)\(.*\),s/\2/\1/,; s, ,,'; echo \'; echo }; }; ;; *) echo "usage: lso tmp-file"; ;; esac; } this won't print out types[1]. but its purpose is not to examine types. its focus is on mode and its purpose is to make mode easier to read (assuming one finds octal easier to read). 1. one could of course argue "everything is a file", but not always a "regular" one. e.g., a "directory" is really just a file comprising a list.
Test'd & work'd fine on: HP-UX, SUSE, with bash # "Work'd" 's are wellcome! APu Show Sample Output
Ever need to get some text that is a specific number of characters long? Use this function to easily generate it! Doesn't look pretty, but sure does work for testing purposes! Show Sample Output
change the time that you would like to have as print interval and just use it to say whatever you want to Show Sample Output
for music file of mp3.zing.vn Show Sample Output
Gets the IP and sticks it into the middle-mouse-click buffer
This is actually quite slow~ P.S. change `seq 2 100` to `seq 2 1000` and try Show Sample Output
Using a standard way to handle error message and return code. Show Sample Output
useful to count events in logs @see: http://www.commandlinefu.com/commands/view/10327/report-summary-of-string-occurrence-by-time-period-hour#comment Show Sample Output
allows command to use switches
works the same, but uses festival instead of espeak
Says time every 5 seconds in hours, minutes and seconds using festival.
Usage:
watch ls -l
Basic but usable replacement for the "watch" command for those systems which don't have it (e.g. the Solaris I'm trapped on).
Type Ctrl+V to escape the following Ctrl+L which clears the screen. It will be displayed as "^L".
optionally you can add
|cut -d' ' -f2|uniq
to the end of the command line.
Take a file and ,."()?!;: give a list of all the words in order of increasing length. First of all use tr to map all alphabetic characters to lower case and also strip out any puntuation. A-Z become a-z ,."()?!;: all become \n (newline) I've ignored - (hyphen) and ' (apostrophe) because they occur in words. Next use bash to print the length ${#w} and the word Finally sort the list numerically (sort -n) and remove any duplicates (sort -u). Note: sort -nu performs strangely on this list. It outputs one word per length. Show Sample Output
I can't find the lid command on my system, there is also another complied program: http://xyne.archlinux.ca/projects/lsgrp/
Emulate (more or less) Git equivalent of
git log --format='tformat:%h %an (%cr) %s'
Show Sample Output
usage: dng BRE [selection] default selection is the last match DNS is ok, but although domainnames may be easier to remember than IP numbers, it still requires typing them out. This can be error-prone. Even more so than typing IPv4 numbers, depending on the domainname, its length and complexity.
Simpler and without all of the coloring gimmicks. This just returns a list of branches with the most recent first. This should be useful for cleaning your remotes. 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: