One of the tools that I use on a regular basis to test network connectivity updates is the “z” option of netcat. Apparently when RedHat rolled out the latest version of their distribution of RedHat Enterprise Linux (RHEL) they decided to move to using the nmap-ncat package instead of the nc package. The command options a very different.
So when attempting to test single port like I would have under previous releases I now use the following syntax:
# echo | nc -w1 $host $port >/dev/null 2>&1 ;echo $?
If the result that is returned is a zero then you have successfully connected to the remote host on the desired port. This also applies to CentOS 7 since it is a “clone” or copyleft port of the RHEL7 binaries.
While logging into one of the Linux jump boxes at work today, it occurred to me that while I recently got notified about my password expiration from our Active Directory farm, I had no idea when my Linux password would expire or what the password life was.
To find out this information you can easily use the chage command.
Here is what the output looks like:
[user@myserver ~]$ chage -l user
Last password change : Apr 09, 2015
Password expires : Jul 08, 2015
Password inactive : never
Account expires : never
Minimum number of days between password change : 1
Maximum number of days between password change : 90
Number of days of warning before password expires : 7
It may seem like such a simple thing to do, but knowing when your password expires can be a lifesaver on occasion.
In my day job as a Systems Engineer I frequently find myself switching between different UNIX and Linux distributions. While many of the commands exist on both sides of the aisle, I often find vast differences in the command line parameters that can be consumed by a given command when used in, for example, Linux vs Solaris.
Recently I came upon this again with the need to easily ferret out the majority consumer of drive space on a Solaris 10 system. While we did have the xpg4 specification support available, the du command was still missing my favorite option “max-depth”.
In Linux I use this to limit the output to only the current directory level so that I don’t have to face to possibility of wading through a tremendously large listing of sub-directories to find the largest directory in the level I am in. Unfortunately, in Solaris, even with xpg4, the du command doesn’t have this option, so my solution was to pipe the results through egrep and use that to filter out the sub-directories.
Here is some example output from a RedHat Linux 5.11 server:
[root@atl4cmweb01 var]# du -h
Here is the same example ouput from the RedHat server using the max-depth option:
[root@atl4cmweb01 var]# du -h --max-depth=1
Here is the command example run without my egrep mod in Solaris 10:
[root@atl4sfsbatchb log]# /usr/xpg4/bin/du -h
And here is the improved command output using my egrep mod on the same Solaris server:
[root@atl4sfsbatchb log]# /usr/xpg4/bin/du -hx | egrep -v '.*/.*/.*'