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"

Sort on multiple dis-contiguous keys/fields (can even specify key number/field from the end)
Notes: 1) -n-1 means sort key is the last field 2) -l is important if each separate record is on a new line (usually so for text files) 3) -j tells msort not to create log file (msort.log) in the working directory 4) may need to install msort package. 5) msort does lot more. Check man msort

copy audio file from playlist to a floder
copy some file from xx.m3u to target folder

Run a ext4 file system check and badblocks scan with progress info
Nothing fancy, just a regular filesystem scan that calls the badblocks program and shows some progress info. The used options are: -c ? check for bad sectors with badblocks program -D ? optimize directories if possible -f ? force check, even if filesystem seems clean -t ? print timing stats (use -tt for more) -y ? assume answer ?yes? to all questions -C 0 ? print progress info to stdout /dev/sdxx ? the partition to check, (e.g. /dev/sda1 for first partition on first hard disk) NOTE: Never run fsck on a mounted partition!

sort ugly text
Often, when sorting you want the sort to ignore extraneous characters. The b, d, and f tell sort to ignore leading blanks, use 'dictionary order' (ignore punctuation), and ignore (fold) case. Add a "u" if you only want one copy of duplicate lines. This is a great command to use within vim to sort lines of text, using !}sort -bdf

Force the script to be started as root
Will run the script as root and exit if the wrong or no password is given. Also will keep the parameters active if any where given.

Recursive Line Count

Download a numbered sequence of files

Anti Syn Ddos
Ddos syn attack

detect the fastest ldap server on a intranet
This command line detect ldap hosts, by mandatory dns entry, then ping them to detect response average. based on ping response average it sorts and print the faster server in first output line


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: