you open multiple files and you have a pattern to be replace on each one of them. For example the pattern is like this spread across hundred's of files. package1-1.12 package2-2.33 The goal is to remove the hyphen ('-') and replace with space on file{1..3} It should look like package1 1.12 package2 2.33 Here how it can be done. vim file{1..3} :bufdo :%s/-\([0-9]\)/ \1/g | w! "a1" 2L, 30C written "a2" 2L, 30C written "a3" 2L, 27C written Show Sample Output
This sequence of pipes will strip the last newline and send the remainder to the X11 clipboard. I have it as: alias clipb='perl -pe "chomp if eof" | xclip -selection c' so I can just do "echo hello | clipb" Multi-line texts will keep their internal newlines, but the last newline will be removed. This usually makes most sense. Show Sample Output
This command will take the output of curl and read it line by line, skipping a step in downloading the file then parsing it. You can then parse each line, or only print the lines that contain certain works using if statements, or whatever you can come up with. Or you can change IFS and use it to parse based on separators other than newline.
Recursively compares files in directories DIR and OLD_FILES using dwdiff Word-by-word comparison with dwdiff results in words unique to NEW file versions in the DIR directory tree shown enclosed in [- SQUARE BRACKETS -] and words unique to OLD file versions in the OLD_FILES directory tree shown enclosed in {+ CURLY BRACES +} Note: does not detect files unique to the OLD_FILES directory tree. Show Sample Output
If you come from a DOS background and accidentally use DOS commands often, this and others like it can be helpful. Add to your .bash_profile, or wherever you keep such things.
You must get your Backup Url from: http://ROUTER_DYN_DNS/admin-bwm.asp under "Backup". I set it up in a curl
Change "sort -f" to "sort" and "uniq -ic" to "uniq -c" to make it case sensitive. Show Sample Output
Provides a cleaner output plus some more details about the IP address. Also, a flaw was corrected where the URL provided the results in Spanish by default. Show Sample Output
Useful if you want to reduce PDF file size using command line by ghostscript.
Get link to external sites of a url Show Sample Output
Check trough unix sockets if tcp port is open or close Show Sample Output
If you have a logfile where some lines start with timestamps like "2014-05-01 12:34:56,123" but other lines are missing the timestamp (like stack traces or object dumps), then use this script to copy the most recent timestamp to any lines that are missing it. This is useful for merging log files, since you can then safely sort by timestamp to merge the files. Show Sample Output
Similar to the following:
curl -I <URL>
but curl -I performs a HEAD request, which can yield different results.
Show top apps that use internet, sorted by count connections and grouped by TYPE and Protocol Show Sample Output
When you block any hosts using this method, the hosts can't do anything in the network. The block is applied on firewall or gateway of the network. Show Sample Output
Here's a quick way to clean up old xauth entries.
Useful command to get information about running java process and treads, to see log look into the default log for your java application
Use zsh process substitution syntax.
!$ will be expanded to the last argument on the previous command. There are also positionnal parameters like !:1, !:2...
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: