A few Random Tips Increasing your Linux-Fu

I came across these random tips recently and thought I’d note them here:

Find

‘find’ is a pretty basic command at face value, but you can leveraging some of the options.  I came across this post that actually shows you how to copy or delete based on your find.

#Removes all tar files from the current directory location
#iname = case insensitive name
find . -iname "*tar" -delete
#Copies all files to a folder based on extension
# -o = OR
find $HOME/ \( -iname "*.sh" -o -iname "*.sh.old" \) -exec cp -v '{}' $HOME/shellscripts/ \;

And the useful, searching multiple directories for a file greater than a certain size:

#Finds files in selected directories >500M
find $HOME /var /etc -size +500M

 

Using DD for I/O Performance Throughput

This post covers the proper use of DD for I/O performance testing, factoring in the time it takes to commit to disk, not just to the RAM buffer

dd bs=1M count=128 if=/dev/zero of=test conv=fdatasync

Of course, block size plays a huge roll in these throughput results, with larger block size producing higher throughput.

 

Using at to schedule one-off tasks instead of cron

Handy tip here.

#if you need to install at, on CentOS, run yum install at, the sudo service atd start
echo /root/daily.sh | at 5:27pm today

 

Netstat & Firewalld

What ports is the server listening on tip here …along with a check for open firewall ports (for firewalld).

#If netstat is not installed, yum install net-tools
#
netstat -lntup
firewall-cmd --list-all

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s