displays current time in "binary clock" format (loosely) inspired by: http://www.thinkgeek.com/homeoffice/lights/59e0/ "Decoding": 8421 .... - 1st hour digit: 0 *..* - 2nd hour digit: 9 (8+1) .*.. - 1st minutes digit: 4 *..* - 2nd minutes digit: 9 (8+1) Prompt-command version: PROMPT_COMMAND='echo "10 i 2 o $(date +"%H%M"|cut -b 1,2,3,4 --output-delimiter=" ") f"|dc|tac|xargs printf "%04d\n"|tr "01" ".*"' Show Sample Output
tr has some predefined sets of characters that are more convenient to use than characters codes
I'm sure there's a more elegant sed version for the tr + grep section.
Here is another way to show the path, one directory per line. The command `tr` translates the colon into the new line, taking input from the $PATH variable Show Sample Output
If the file content is : - Blah blah blah ABC hello blah blah blah bloh bloh bloh DEF Bah bah bah - You'll get: - ABC hello blah blah blah bloh bloh bloh DEF
This works in bash and zsh.
You may also want to alias it, if you need to look at it often...
alias lpath="echo \$PATH | tr : \\\\n"
"\$PATH" to make sure to look at your current $PATH
Show Sample Output
Adjust the
head -c
part for password length.
I use filenames like "hans@commandlinefu.com.gpg" and a vim which automatically decrypts files with .gpg suffixes.
This is a quick line to stream in the latest offerings of your favorite netcasts/podcasts. You will need to have a file named netcast.txt in the directory you run this from. This file should have one and only one of your netcast's/podcst's url per line. When run the line grabs the offering on the top of the netcast/podcast stack and end it over , quietly, to vlc. Since I move around computers during the day I wanted an easy way to listen to my daily dose of news and such without having to worry about downloading to whatever machine I am on. This is just a quick grab and stream of whats current. Future plans... have the list of netcasts be read from the web. possibly an rss or such. I use greader so there might be a way to use it as the source so as not to have to muck with multiple lists Show Sample Output
convert mixed case in a file to lower case
Simply translates whitespace to newlines. Could be enhanced to compress out extra newlines, but that might be better handled in the next tool down the pipe, with eg uniq(1).
Same as above but slooooow it down
Get a list of all the unique hostnames from the apache configuration files. Handy to see what sites are running on a server. A slightly shorter version.
This is N5 sorta like rot13 but with numbers only. Encrypt echo "$1" | xxd -p | tr '0-9' '5-90-6' Decrypt echo "$1" | tr '0-9' '5-90-6' | xxd -r -p Show Sample Output
The output is only partial because runtime dependencies should count in also commands executed via system() and libraries loaded with dlopen(), but at least it gives an idea of what a package directly links to. Note: this is meaningful *only* if you're using -Wl,--as-needed in your LDFLAGS, otherwise it'll bring you a bunch of false positives. Show Sample Output
Reads 4 bytes from the random device and formats them as unsigned integer between 0 and 2^32-1. Show Sample Output
The script gets the dimensions and position of a window and calls ffmpeg to record audio and video of that window. It saves it to a file named output.mkv Show Sample Output
Remove empty lines additionally:
tr -s ' \t\n' <1.txt >2.txt
identical with:
tr -s '[:space:]' <1.txt >2.txt
To "clean perfectly" a text or code file, You can combine this command with
another one:
while read l; do echo -e "$l"; done <1.txt >2.txt
(= remove all leading and trailing spaces or tabs from all lines of a text file)
Feel free to put this in your ~/.profile:
random(){ cat /dev/urandom | env LC_CTYPE=C tr -dc $1 | head -c $2; echo; }
Then use it to generate passwords:
random [:alnum:] 16
Or DNA sequences:
random ACGT 256
This command is similar to the alternate, except with head(1), you can pick as many passwords as you wish to generate by changing the number of lines you wish to preview. 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: