All commands (14,187)

What's this?

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.

Share Your Commands


Check These Out

Binary digits Matrix effect
Silly Perl variant.

Create a continuous digital clock in Linux terminal
Same effect, only shell commands.

Delete Last Line of a File if it is Blank
Use sed to remove the last line of a file only if it is empty.

Recursive search inside the content of files under current directory - then view the result paginated with 'less'
This command will traverse all of the folders and subfolders under current working directory. For every file inside it, it will do a search inside the content of the file for a specific term 'what'. Then it will print a list of the lines that contain that term (and match that pattern). Each matching line will be preceded with the path and name to the file and then the line number iside taht file wehre the pattern was found. Then the actual content of the matching lien will be printed. The output will be piped throug less, so that the user can scroll through it if it goes beyond the limits of the current display window.

Rename file to same name plus datestamp of last modification.
Note that the -i will not help in a script. Proper error checking is required.

Lists installed kernels

Create a .png from a command output and upload to ompdlr.org, give URI
Create a .png from output command or whatever, the upload and give URI from ompdlr.org

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Send e-mail if host is 'dead' or not reachable
Cleaner with a mailto assignment in crontab (if the command fails you get an email): MAILTO=admin@example.com 10,30,50 * * * * ping -q -c1 -w3 192.168.0.14 >/dev/null

Search $PATH for a command or something similar
Searches your $PATH for whatever you substitute for bash, though not sure if this will work if you substitute a different shell for bash!


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: