Understanding a little more about /etc/profile and /etc/bashrc

Recently I was working on an issue where an application was not retaining the umask setting set in the root users profile or /etc/profile. After looking into the issue a bit it seemed that the application in question only applied the umask setting that was set in /etc/bashrc and would not even accept the values being the applications own start scripts. After doing a bit of researched I learned a little bit more about what exactly these files do, the differences between them and when they are executed.

Finding the OS version and Distribution in Linux

When supporting systems you have inherited or in environments that have many different OS versions and distributions of Linux. There are times when you simply don't know off hand what OS version or distribution the server you are logged into is. Luckily there is a simple way to figure that out. Ubuntu/Debian $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.04 DISTRIB_CODENAME=raring DISTRIB_DESCRIPTION="Ubuntu 13.04" RedHat/CentOS/Oracle Linux # cat /etc/redhat-release Red Hat Enterprise Linux Server release 5 (Tikanga) Catchall If you are looking for a quick way and don't care what the output looks like, you can simply do this as well.

Installing MySQL on Ubuntu/Debian

MySQL is the most popular open source relational database management system (RDBMS) in the world. MySQL is used by everyone from the simple small business website to the large internet giants like Facebook, Google or Amazon. In fact the contents of this page are even stored within MySQL. Installing MySQL is a fairly common task for any systems administrator; especially if that administrator is running a standard LAMP stack (Linux, Apache, MySQL & PHP/Python/Perl).

How to check if a cron job ran

Cron is a time based scheduled task daemon that runs on most common Unix/Linux distributions. Because cronjobs are time based sometimes it is necessary to validate that the job ran at the scheduled time. Sometimes people will configure a cron to send the output of the script to a user via system mail or redirect the output to a file; however not all crons are setup the same and many times they may be configured to send output to /dev/null hindering any ability to validate the job ran.

dpkg: Listing installed packages

If you want to check what packages are installed on a debian based machine you can use dpkg. slize:~# dpkg --list Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-=========================================== ii adduser 3.110 add and remove users and groups ii apache2 2.2.9-10+lenny7 Apache HTTP Server metapackage ii apache2-mpm-prefork 2.2.9-10+lenny7 Apache HTTP Server - traditional non-threaded model Or if you are looking for a specific package you can put the name after the command.

apt: Searching for packages

Using the “Advanced Package Tool” aka apt to install utilities is one of the easiest ways to install software in Linux/Unix. Here is an example of searching for packages. Example: [email protected]:~/Downloads$ apt-cache search libcurl3 libcurl3 - Multi-protocol file transfer library (OpenSSL) libcurl3-dbg - libcurl compiled with debug symbols libcurl3-gnutls - Multi-protocol file transfer library (GnuTLS) libcurl3-nss - Multi-protocol file transfer library (NSS) libcurl4-gnutls-dev - Development files and documentation for libcurl(GnuTLS) libcurl4-nss-dev - Development files and documentation for libcurl (NSS) libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL)