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

Generate a Change Log with git
Generate a changelog between the v1 and v2 tags

Browse system RAM in a human readable form
This command lets you see and scroll through all of the strings that are stored in the RAM at any given time. Press space bar to scroll through to see more pages (or use the arrow keys etc). Sometimes if you don't save that file that you were working on or want to get back something you closed it can be found floating around in here! The awk command only shows lines that are longer than 20 characters (to avoid seeing lots of junk that probably isn't "human readable"). If you want to dump the whole thing to a file replace the final '| less' with '> memorydump'. This is great for searching through many times (and with the added bonus that it doesn't overwrite any memory...). Here's a neat example to show up conversations that were had in pidgin (will probably work after it has been closed)... $sudo cat /proc/kcore | strings | grep '([0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\})' (depending on sudo settings it might be best to run $sudo su first to get to a # prompt)

Query Wikipedia via console over DNS
Shorter version, works with multiple words.

print character classes
Today I needed a way to print various character classes to use as input for a program I was writing. Also a nice way to visualize character classes.

Easily scp a file back to the host you're connecting from
Place in .bashrc and invoke like this: "mecp /path/to/file", and it will copy the specified file(s) back to the desktop of the host you're ssh'ing in from. To easily upload a file from the host you're ssh'ing in from use this: ucp (){ scp ${SSH_CLIENT%% *}:Desktop/upload/* .; }

Trick find -exec option to execute alias
An alias cannot be executed as command in a find -exec line. This form will trick the command line and let you do the job.

List .log files open by a pid
Uses lsof to display the full path of ".log" files opened by a specified PID.

Find the biggest files
Show the top 10 file size

Find the location of the currently loaded php.ini file

Swap the two last arguments of the current command line
Say you just typed a long command like this: $ rsync -navupogz --delete /long/path/to/dir_a /very/long/path/to/dir_b but you really want to sync dir_b to dir_a. Instead of rewriting all the command line, just type followed by , and your command line will read $ rsync -navupogz --delete /very/long/path/to/dir_b /long/path/to/dir_a


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: