LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs > sag47
User Name
Password

Notices

Uncategorized Entries with no category
Old

Limiting and blocking connections dynamically.

Posted 10-31-2011 at 03:46 PM by sag47
Updated 01-29-2014 at 11:14 AM by sag47

Today I feel like talking about limiting connections which get made to a server. There are a few ways to do it; some cooler than others. I'd like to feature some open source software while I'm at it.

Today I happened upon this thread which hilariously got closed for good reason. Once you wade through all the crap you'll see some pretty cool posts which explain how to limit incoming connections within a certain time period and other suggestions. I'll point out the most useful related...
Senior Member
Posted in Uncategorized
Views 720 Comments 0 sag47 is offline
Old

Server latency

Posted 10-27-2011 at 08:26 AM by sag47

I wanted a quick and dirty way to determine server latency on my Kubuntu machine. This just parses simple output from ping and provides only the time values.

Code:
for x in drexel.edu google.com;do echo -n "[$x]: "; ping -c 1 $x | head -n 2 | tail -n 1 | awk '{split($8,arr,"=")} END{print arr[2],$9}';done
Output
Code:
[drexel.edu]: 0.576 ms
[google.com]: 6.23 ms
You can put as many servers or IPs as you want in the for loop to get a comparison....
Senior Member
Posted in Uncategorized
Views 497 Comments 0 sag47 is offline
Old

Network usage on a single device and log diving

Posted 09-27-2011 at 02:57 PM by sag47
Updated 09-29-2011 at 08:30 AM by sag47
Tags networking

I wanted to know the received network usage on a device in kB so this one liner was produced for the desired result.
Code:
while true; do y=`ifconfig eth0 | grep RX\ bytes| sed -e 's/.*bytes\://' -e 's/\ .*//'`; sleep 1; x=`ifconfig eth0 | grep RX\ bytes| sed -e 's/.*bytes\://' -e 's/\ .*//'`; echo $(((x-y)/1024)); done
Press Ctrl+C to stop analyzing the network traffic on that device.

Here's another one liner of me looking through multiple log locations.
...
Senior Member
Posted in Uncategorized
Views 571 Comments 0 sag47 is offline
Old

Simulate -print0 with ls

Posted 09-07-2011 at 03:39 AM by sag47
Tags find

Recently I wanted to manipulate files only in the current directory (not sub-directories). I usually use the following combination...

Code:
find . -type f -print0 | xargs -0 somecommand
The only problem I had with that was it ran through all sub-directories as well. Then I remembered the -m switch for ls and decided to depend on my good old friend sed.

Code:
ls -m | sed 's/, /\x0/g' | xargs -0 somecommand
Though I guess it would be better to do it...
Senior Member
Posted in Uncategorized
Views 1510 Comments 0 sag47 is offline
Old

rsync commands and how I backup

Posted 06-23-2011 at 05:06 PM by sag47
Updated 06-23-2011 at 05:07 PM by sag47

I run the following command when I want to just update one directory to another. It only copies files that have changed. If any files have been deleted from A they still exists in directory B. The trailing slash after A/ is necessary to tell rsync to move the contents. Otherwise A will create a folder in B called /media/B/A and move the files over.

Code:
rsync -ruptv /media/A/ /media/B
I run the following command when I want to mirror one directory to another. Any files...
Senior Member
Posted in Uncategorized
Views 661 Comments 0 sag47 is offline

  



All times are GMT -5. The time now is 06:47 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration