Commands using echo (1,545)

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

disk space email alert
put it in crontab to get an alert when / is over 89% utilization.

Substitute an already running command
eg: Already running cmd $sleep 120 Substitution cmd $c=$(pgrep sleep) && sleep 5 && kill $c

Use /dev/full to test language I/O-failsafety
The Linux /dev/full file simulates a "disk full" condition, and can be used to verify how a program handles this situation. In particular, several programming language implementations do not print error diagnostics (nor exit with error status) when I/O errors like this occur, unless the programmer has taken additional steps. That is, simple code in these languages does not fail safely. In addition to Perl, C, C++, Tcl, and Lua (for some functions) also appear not to fail safely.

View files opened by a program on startup and shutdown
Run this before you run a command in order to see what the command does as it starts. The -c flag is useful here as the PID is unknown before startup. All config files, libraries, logs, ports, etc used by the command as it starts up, (and shuts down) will be captured at 1s intervals and written to a file. Useful for debugging etc.

Check disk I/O

list block devices
Shows all block devices in a tree with descruptions of what they are.

Show directories in the PATH, one per line
quoteless

find broken symbolic links
== remove broken links == find -L . -type l -exec rm -rf {} \; == how this work == "symbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use -xtype." -- manpage of find.

Convert from octal format to umask
Umask is obtained subtracting 7 from each cypher of octal format. I store octal perm format in an array,then for each element of array I subtract 7. The result is the umask.

Get acurate memory usage of a Process in MegaBytes


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: