This will generate 3 paragraphs with random text. Change the 3 to any number. Show Sample Output
This command will format your alias or function to a single line, trimming duplicate white space and newlines and inserting delimiter semi-colons, so it continues to work on a single line. Show Sample Output
Tired copy paste to get opcode from objdump huh ? Get more @ http://gunslingerc0de.wordpress.com Show Sample Output
If you're going to use od, here's how to suppress the labels at the beginning. Also, it doesn't output the \x, hence the sed command at the end. Remove it for space separated hex values instead Show Sample Output
Default output-file is "liveh.txt". This uses only BRE, in case you're using an older version of sed(1) that doesn't have support for ERE added. With a modern sed(1), to reduce false positive matches, you might do something like: liveh(){ tcpdump -lnnAs512 -i ${1-} tcp |sed 's/.*GET /GET /;s/.*Host: /Host: /;s/.*POST /POST /;/GET |Host: |POST /!d;/[\"'"'"]/d;/\.\./d;w '"${2-liveh.txt}"'' >/dev/null ;} Anyway, it's easy to clean up the output file with sed(1) later.
substitute "example" with desired string; tl = target language (en, fr, de, hu, ...); you can leave sl parameter as-is (autodetection works fine) Show Sample Output
Modify file in place to remove empty lines and create a backup of the original with the extension .bak Show Sample Output
Gets a BOFH excuse from the BOFH excuse server (towel.blinkenlights.nl port 666), and passes it through sed and tr to get rid of telnet connection stuff. Show Sample Output
This command outputs a table of sighting opportunities for the International Space Station. Find the URL for your city here: http://spaceflight.nasa.gov/realdata/sightings/ Show Sample Output
usage: mem memcache-command [arguments] where memcache-command might be: set add get[s] append prepend replace delete incr decr cas stats verbosity version notes: exptime argument is set to 0 (no expire) flags argument is set to 1 (arbitrary)
Using the sed -i (inline), you can replace the beginning of the first line of a file without redirecting the output to a temporary location.
- grep for the word in a files, use recursion (to find files in sub directories), and list only file matches -| xargs passes the results from the grep command to sed -sed -i uses a regular expression (regex) to evaluate the change: s (search) / search word / target word / g (global replace)
This should work with anything://url.whatever etc etc ;)
pgrep foo
may return several pids for process foobar footy01 etc. like this:
11427
12576
12577
sed puts "-p " in front and we pass a list to top:
top -p 11427 -p 12576 -p 12577
This makes your commandlinefu.com's favorites appear as most recent commands in your history.
(Please see sample output for usage) script.bash is your script, which will be crypted to script.secure script.bash --> script.secure You can execute script.secure only if you know the password. If you die, your script dies with you. If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string). Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner. Show Sample Output
Automatically drops mount points that have non-numeric sizes (e.g. /proc). Tested in bash on Linux and AIX. Show Sample Output
Opposite:
Convert an one-liner to script:
foo() { <one-liner> ; }
...
typeset -f foo
...
unset -f foo
Show the current load of the CPU as a percentage.
Read the load from /proc/loadavg and convert it using sed:
Strip everything after the first whitespace:
sed -e 's/ .*//'
Delete the decimal point:
sed -e 's/\.//'
Remove leading zeroes:
sed -e 's/^0*//'
Show Sample Output
weather 97405
Show Sample Output
Very quick way to change a word in a file. I use it all the time to change variable names in my PHP scripts (sed -i 's/$oldvar/$newvar/g' index.php)
Very useful when the ssh key of a host has changed and ssh refuses to connect to the machine, while giving you the line number that has changed in ~/.ssh/known_hosts.
The ctrl+v,ctrl+m portion represents key presses that you should do. If you do it successfully you should see a ^M character appear.
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.
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
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: