Reese Knowledgebase

Sub Categories
folder Linux (58)
Linux tidbits
folder Solaris (20)
Solaris OS tidbits
folder Scripting (15)
Scripting tips, including quick one-liners

Showing: 1-20 of 23    »»
document Search for largest files in a file system
This command will search for files 5 MB or larger, then list its size and location from smallest to largest in size.  Replace the mount point with which ever mount you want to look in, hence the -mount option to tell find not to descend directories on other filesystems. find / -mount -type f...
31 May, 2013
document Redirecting standard output and standard error
Redirecting standard output and standard error 2>/dev/null >/dev/null 2>&1 2>&1 The first specifies that all error messages should be sent to /dev/null The second says to redirect standard output to /dev/null and redirect standard error to standard output,...
06 Nov, 2015
document Job Control in Unix
Useful CommandsSummary control-z Stop (don't kill) the foreground job, and then return to the shell jobs Check the status of jobs in the current session ps -u username Check the status of...
27 Jan, 2012
document Display top 10 processes eating up CPU
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 I also like this format to display by user: ps -U apache -u apache u
16 Apr, 2013
document Forcing qmail to send messages
kill -ALRM `pgrep qmail-send`
19 Mar, 2012
document Using wget to download iso from rhn
Using wget to download an iso from redhat network Copy the download URL and use a command line utility to complete the download. The advantage of using a command line utility like wget is the ability to continue a paused download if a problem was encountered during the download process. To do...
12 Dec, 2012
document Use nmap to scan network
Scan network for responsive IPs nmap -sS -O | tee nmap.log Check if port is open nmap -P0 -p1521
20 Jul, 2012
document Setting file formats in VIM
Sometimes, my scripts will be in DOS format with that pesky CR (Carriage Return) ^M charater and the end of each line.  A simple way to rid your file of it is to set the file format in a vim session as follows: :set ff=unix Otherwise, the ^M can be created by depressing the...
11 Jul, 2012
document Various tar/gzip one liners
Here, we are sending the tar file to ``-'', which stands for tar's standard output. This is piped to gzip, which compresses the incoming tar file, and the result is saved in backup.tar.gz. The -c option to gzip tells gzip to send its output to stdout, which is redirected to backup.tar.gz. # tar...
21 Feb, 2013
document How to decode a base64 string
How to decode a base64 string perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.txt > out -or- echo "MTA5MjhFYWdsZVJpdmVyUg==" | base64 -d -
10 Aug, 2012
document crontab format
Here's a quick comment that can be added to users crontabs as a reminder to the crontab format: # m h dom mon dow command There are various ways to schedule a command to run, such as every 5 minutes, that would be considered acceptable format by some linux distributions, and not accepted by...
10 Oct, 2014
document Netmasks Table
Netmask Table Decimal   0;     0;  Binary                                     CIDR...
15 Oct, 2012
document How to obtain the public IP of servers on a private network
Ever wanted to know what the public IP or NAT is of your private servers is when they go out to the Internet? wget -q -O - or using curl: curl -4 This can come in real handy when try to troubleshoot connectivity between two systems in which you have...
16 Dec, 2014
document Advanced techniques for using the UNIX find command
I found this article on IBMs Developer Works site and had to put it here!  Some of this is basic, but it's a good read nonetheless. There's nothing quite like the thrill of exploring, discovering new people, places, and things. The territory might change, but a few principles remain...
25 Jan, 2013
document Enable automatic logoff
Enabling automatic logoff Let's face it.  Sometimes admins leave themselves logged into a system and walk away.  Systems can be set to automatically logoff a user after a period of activity by setting some parameters in /etc/profile (Linux/Solaris), /etc/security/.profile (AIX). ...
01 Feb, 2013
document How to disable cron from sending email alerts
How to disable cron based mail alerts The easiest way to disable cron based email alerts is to append the following to the specified command within the users crontab: >/dev/null 2>&1 Example: # m h dom mon dow command 59 23 * * * /root/scripts/hotfixes/vzagent >/dev/null...
05 Feb, 2013
document Sort IP Addresses in bash
Sort list of IP addresses via command line Do you have a text file filled with a bunch of IP addresses, and it won't sort properly with the -n option alone?  Providing additional options can help achive the desired output. $ cat nfs_clients | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k...
20 Feb, 2013
document Use sed or tr to remove parentheses from string
How to use sed or tr to remove parentheses from a string In grub.conf, the kernel version is shown in the title line for each kernel version that's available for the system to boot.  I had a use case where I wanted to extract this information from this file within a pxeboot session, whereby...
10 Aug, 2013
document sed one liners
sed one liners Insert character at beginning of line Example: comment out all nfs entries in /etc/fstab sed -i '/nfs/s/^/#/' /etc/fstab Uncomment out all nfs entries in /etc/fstab sed -i '/nfs/s/^#//g' /etc/fstab Substitute a character at a specific line Change line 108 of /etc/sudoers by...
11 Sep, 2015
document Setting relayhost in postfix
Setting relayhost in postfix The relayhost parameter specifies the default host to send mail to.  This is equivalent to the DS entry in sendmails MTA config file. output below has been trucated for purposes of doucmentation: PROD linux ~ # cat /etc/postfix/ #...
19 Jul, 2013