You can use this to loop any command to periodically see the output.
while true; do [YOUR COMMAND HERE]; sleep [# of seconds]; done;
Alternatively, you can put it in a simple shell script to save typing!
#/!bin/bash
while true; do $1; sleep $2; done;
/path/to/script.sh "ifconfig eth0 | grep 'inet addr:'" 60
Show Sample Output
Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all... At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc So for a specific port, this line returns the calling command line of every thread that handle the associated socket
Just find out the daemon with $ netstat -atulpe. Then type in his name and he gets the SIGTERM.
alias ps?='psg' for maximum hawtness. Works in bash or zsh. Show Sample Output
For those of us that still uses lynx :)
Recursive grep through directory for file.
HP UX doesn't have a -a switch in the ifconfig command. This line emulates the same result shown in Solaris, AIX or Linux Show Sample Output
This will kill a specific process you don't know the PID of, when pidof and pgrep are not available, for example on OS X. var1 is created so that the whitespace can be trimmed before passing off to kill. Show Sample Output
This assumes your local ip starts with 192.something (e.g. 192.168), it greps ifconfig output for an ip that starts with 192, then strips the extra garbage (besides the ip) Maybe `ifconfig | grep addr | grep Bcast` would also do it Show Sample Output
IMVHO if you are using cpan to install perl modules you are doing it wrong. Show Sample Output
Finds a string in files recursively below the current directory on systems without the "egrep" and its "-r" functionality. Show Sample Output
grep '^[^#]' sample.conf \__/ |||| \_________/ | |||| | | |||| \- Filename | |||| | |||\- Only character in group is '#' | ||| | ||\- Negate character group (will match any cahracter *not* in the | || group) | || | |\- Start new character group (will match any character in the | | group) | | | \- Match beginning of line | \- Run grep Empty lines will also be not matched, because there has to be at least one non-hash-sign character in the line. Show Sample Output
Check if Fail2Ban is running on the system and alert it with a message in the terminal Show Sample Output
Shows all linked file and destinations. The 'ls -l' command lists the files in long (1 file per line) format, and the grep command displays only those lines that starts with an l (lower case L) -- a linked file. Updated: Remove reference to hard links because this command does not apply to hard link as others kindly pointed out. Show Sample Output
Get the IP address of all your network cards. Show Sample Output
-f file -v invert-match : invert the sense of matching, to select non matching lines
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: