commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Fast and easy way to find all established tcp connections without using the netstat command.
calculate how many different lines between two files
Open Port Check
Get the longest match of file extension (Ex. For 'foo.tar.gz', you get '.tar.gz' instead of '.gz')
`pwd` returns the current path
`grep -o` prints each slash on new line
perl generates the paths sequence: './.', './../.', ...
`readlink` canonicalizes paths (it makes the things more transparent)
`xargs -tn1` applies chmod for each of them. Each command applied is getting printed to STDERR.
On wired connections set 'eth0' instead of 'wlan0'
Runs a diff on two files ignore comments and blank lines (diff -I=RE does not work as expected). Adapted from a post found on stackexchange.
Lists everithing using -l "long listing format" wich includes the space used by the folder. Displays it in -h "human readable form" (i.e. 2.2G, 32K), and -R recurses subfolders.
grep -e using a regex, show lines containing the word "total" or a ":" at the end of the line (those with the name of the folder) only.
Substitute for #11720
Can probably be even shorter and easier.
Requirements: curl, grep, awk, internet connection with access to wikipedia
If you can make shorter version of this listgetter, you are welcome to paste it here :)
Will search for the given pattern and build a list of occurrences.
Then you can use :copen and :cclose to toggle the list.
When browsing the list, ENTER will take you to that line in the file.
Old Sys5 system and SUN computers don't have the -H option. Adding /dev/null forces grep to use the multi-file output and report the file name.
Add this line to your ~/.gitconfig for a git alias "git brd" (i.e., brd = (br)anch+(d)ate) which sorts branches by date. Allows you to pass in limited "git branch" options such as "-r" (remote) or "-a" (all). (Note: forum added "$" prefix to command; obviously in gitconfig there is no "$" prefix.)