Archive
Posts in Linux
Listing packages that were added or updated after an initial Fedora or CentOS installation
I was reviewing the configuration of a system last week, and needed to find out which packages were added after the initial installation. The rpm utility has a slew of options (you can view the list of options by running ) to query the package database, including the extremely handy INSTALLTIME option. Using this query value along with my pkgdiff script, I was able to generate a list of packages that were installed (or updated) after the initial install: Now this doesn't take into account package updates, but it should be pretty easy to identify which items were added vs. updated with a couple more lines of shell script (you could cross reference the package list above with /root/install.log if you need to get super specific).
$ read more →Switching between the KDE and GNOME window managers on Centos and Fedora Linux hosts
I recently switched a Fedora host from the GNOME window manager to KDE. This exercise allowed me to familiarize myself with how X and the various window managers are organized on Fedora hosts, and I thought I would jot down how to switch between window managers for future reference. When a Fedora host is booted into run-level 5, the following initab entry will cause the X server and Window manager to start: The prefdm script uses the /etc/sysconfig/desktop file to control which window manager (KDE or GNOME) is started, as you can see in the following code snippet from the script: So to set the default window manager to GNOME, you can set the DISPLAYMANAGER variable to GNOME: To use KDE, you can set the DISPLAYMANAGER variable to KDE: I dig the fact that Fedora and CentOS Linux servers control application settings through configuration files in /etc/sysconfig. This makes it easy to adjust application settings, and ensures that a package update won't whack your customizations…
$ read more →Restarting X and the GNOME window manager on Linux hosts
I useGNOME as my primary desktop at work, and periodically need to restart the Xserver / windowing environment to pick up new changes. If I have an X environment up and running, I will send a cntrl + alt + backspace to restart the X server. If for some reason I'm not able to send the key sequence above (this isn't feasible if I'm logged in remotely), I will run the telinit command to switch to run level 3 (multi user mode w/o X), then execute it a second time to switch back to run level 5 (multi user mode w/ X): The latest GNOME bits are pretty slick, though I'm starting to dig KDE again (I used to use KDE years ago). I plan to share my experience with the latest KDE bits in a future post.
$ read more →Making sense of cron in Centos and Fedora Linux
CentOS and Fedora Linux use a set of directories in /etc to control when jobs run. These directories take the following form: To add a job to run hourly, daily, weekly or monthly, you can drop an executable shell script in the pertinent directory. I recently became curious which time of the day daily jobs execute, which day weekly jobs run, and when monthly jobs were scheduled. The answer to these questions comes in the way of /etc/crontab, which contains crontab formatted entries that call the run-parts script to invoke the scripts in the hourly, daily, weekly or monthly directory.
$ read more →Backing up and restoring partition tables on Linux hosts
I recently had to adjust the partition layout on a couple of disk drives. This work occurred on devices with actual data (I made backups before starting), so I needed to be extra careful while performing my work. To ensure that I could recover the data if something went wrong with the partitioning, I made backups of each partition prior to beginning work. Assuming you are using a DOS (MBR) labeled disk, there are two ways to back up the partition table: Use dd to archive sector 0 to a safe location Archive the partition table to a safe location with parted or sfdisk To backup a device using option 1, you can use a dd statement similar to the following: To restore the partion table using dd, you can can alter the dd source and destination like so: While this approach works well, I tend to prefer the second method…
$ read more →