This will allow you to watch as matches occur in real-time. To filter out only ACCEPT, DROP, LOG..etc, then run the following command: watch 'iptables -nvL | grep -v "0 0" && grep "ACCEPT"' The -v is used to do an inverted filter. ie. NOT "0 0"
Show apps that use internet connection at the moment. Can be used to discover what programms create internet traffic. Skip the part after awk to get more details, though it will not work showing only unique processes. This version will work with other languages such as Spanish and Portuguese, if the word for "ESTABLISHED" still contain the fragment "STAB"(e.g. "ESTABELECIDO") Show Sample Output
Place this in your .bash_profile and you can use it two different ways. If you issue 'h' on its own, then it acts like the history command. If you issue:
h cd
Then it will display all the history with the word 'cd'
For fancier and cleaner output, try the following snippet :
showendlines(){ while read i; do od --address-radix=n --width=$(wc -c <<< "$i") -c <<< "$i" | perl -pe 's/.\K\s{2,3}//g'; done < $1 | grep --color '\\.'; }
Now you can run that with :
showendlines <FILE>
Thanks to prince_jammys to "debug" my English ;)
Knowing when a filesystem is created , you can deduce when an operating system was installed . find filesystem device (/dev/) informations by using the cat /etc/fstab command. Show Sample Output
The above url contains over 6700 of the common ad websites. The command just pastes these into your /etc/hosts. Show Sample Output
This version works on Mac (avoids grep -P, adding a sed step instead, and invokes /usr/bin/perl with full path in case you have another one installed). Still requires that you install perl module HTML::Entities ? here's how: http://www.perlmonks.org/?node_id=640489
Sometimes a program refuses to read a file and you're not sure why. You may have display_errors turned off for PHP or something. In this example, fopen('/var/www/test/foo.txt') was called but doesn't have read access to foo.txt. Strace can tell you what went wrong. E.g., if php doesn't have read access to the file, strace will say "EACCESS (Permission denied)". Or, if the file path you gave doesn't exist, strace will say "ENOENT (No such file or directory)", etc. This works for any program you can run from the command-line, e.g., strace python myapp.py -e open,access... Note: the above command uses php-cli, not mod_php, which is a different SAPI with diff configs, etc. Show Sample Output
Taking file with ip ranges, each on it's own line like:
cat ipranges.txt
213.87.86.160-213.87.86.193
213.87.87.0-213.87.88.255
91.135.210.0-91.135.210.255
command returns deaggregated ip ranges using ipcalc deaggregate feature like that:
213.87.86.160/27
213.87.86.192/31
213.87.87.0/24
213.87.88.0/24
91.135.210.0/24
Useful for configuring nginx geo module
Show Sample Output
-P activates the Perl regular expression mode.
Displays a connection histogram of active tcp connections. Works even better under an alias. Thanks @Areis1 for sharing this one.
* to get the English dictionary: wget http://www.mavi1.org/web_security/wordlists/webster-dictionary.txt Show Sample Output
This command will give you a list of available keyboard shortcuts according to stty. Show Sample Output
This one-liner will use strace to attach to all of the currently running apache processes output and piped from the initial "ps auxw" command into some awk. Show Sample Output
Useful for getting to know the available keyboard shortcuts. Show Sample Output
Uses lsof to list open network connections (file descriptors), grepping for only those in an established state
Sometimes apache will get stuck in an established state where you can't get a list of the connecting IP's from mod_status... not a good thing when you need to ban an abusive ip.
Find all files that contain string XXX in them, change the string from XXX to YYY, make a backup copy of the file and save a list of files changed in /tmp/fileschanged.
This command gives a model information of a computer. Also useful in determining the host is a VM machine or actual physical machine. Show Sample Output
This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.
Give the Speed and Link status of eth# 0-3. This is sort of what mii-tool does, but eth-tool is better, yet lacks device discovery. Show Sample Output
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: