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

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

subtraction between lines

Search apache virtual host by pattern
Outputs contents of virtual hosts containing PATTERN. Particularly useful for pefrorming complex searches. E.g. search for docroot of www.example.com: $ sed -n '/^[^#]*

Do some Perl learning...
Prerequisites: module Pod::Webserver installed. You can install it typing: $ sudo perl -MCPAN -e 'install Pod::Webserver' You can replace elinks with your fav browser. For FF: $podwebserver& sleep 2; firefox -remote 'openurl( http://127.0.0.1:8020/, new-tab )' If you have Firefox open, this will pop-up the index web in a new tab.

Send an email from the terminal when job finishes
Might as well include the status code it exited with so you know right away if it failed or not.

search for text in files. recursive.
recursively search dir for a a particular file type, search each file for a particular text.

Stream audio over ssh
This will allow you to convert an audio file to wav format, and send it via ssh to a player on the other computer, which will open and play it there. Of course, substitute your information for the sound file and remote address You do not have to use paplay on the remote end, as it is a PulseAudio thing. If the remote end uses ALSA, you should use aplay instead. If it uses OSS, you should berate them about having a lousy sound system. Also, you're not limited to transmitting encoded as wav either, it's just that AFAIK, most systems don't come with mp3 codecs, but will play wav files fine. If you know SoX is installed on the remote end and has mp3 codecs, you can use the following instead: $ cat Klaxon.mp3 |ssh thelab@company.com play -t mp3 - this will transmit as mp3. Again, use your specific information. if you're not playing mp3s, use another type with the -t option

Shutdown a Windows machine from Linux
This will issue a shutdown command to the Windows machine. username must be an administrator on the Windows machine. Requires samba-common package installed. Other relevant commands are: net rpc shutdown -r : reboot the Windows machine net rpc abortshutdown : abort shutdown of the Windows machine Type: net rpc to show all relevant commands

fix broken permissions


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: