Back to HOWTOs

Linux HOWTOs


This an eclectic mix of various things for Linux.

Related Pages


  • Determine Your Red Hat Version
    • Best method
      rpm -qi redhat-release
    • Alternative method
      cat /etc/issue

  • Determine Your Linux Kernel Version
    • uname -r

  • Determine Your MAC Address
    • /sbin/ifconfig eth0

  • Recursively Grep All Files Matching a find Regular Expression
    • In the C shell, add the following alias:
      alias findgrep 'find . -name "\!:1" | xargs grep -n \!:2* /dev/null'
    • In the bash shell, add the following function:
      function findgrep {
         for i in `find . -name "${1}"`;
         do grep -H -n "${2}" $i;
      Note: If you input a wildcard to find (e.g., *.h), you may need to put quotes around it (e.g., findgrep "*.h" my_string) to avoid having Bash to an automatic wildcard expansion.

  • Print on One Side or Both Sides of the Paper
    • Use one of the following lpr options depending on what you want to do:
      -o sides=one-sided
      -o sides=two-sided-short-edge
      -o sides=two-sided-long-edge

  • Print Text Files Two Per Page With Tabstops Set to Three
    • In the C shell, add the following alias:
      alias enscript2 'enscript -2G -Pps4s -r -T 3 -M Letter'

  • Print Two Pages Per Sheet
    • Instead of using lpr to print, use the following command:
      mpage -2
      The -2 can be replaced with -4 or -8 for more pages per sheet. This command can be used as the print command in Adobe's Acrobat Reader in Linux to print PDFs two sheets per page.

  • Print "Pretty" Text Files Two Pages Per Sheet With Tabstops Set to Three
    • In the C shell, add the following alias:
      alias enscript2 'enscript -2G -Pps4s -r -T 3 -M Letter'

  • Append (or Prepend) to Your PATH Variable
    • C Shell
      setenv PATH "${PATH}:/path/to/be/added/"
      setenv PATH "/path/to/be/added/:${PATH}"
    • Bash Shell
      export PATH=/path/to/be/added/:$PATH
      export PATH=$PATH:/path/to/be/added/

  • Undo in VIM
    • This page has an overview of the commands:
      • u = undo [count] changes
      • :u[ndo] = undo one change
      • CTRL-R = Redo [count] changes which were undone
      • :red[o] = Redo one change which was undone
      • U = Undo all latest changes on one line

  • Apply Patches To Older Versions of Red Hat
    • If you need to install Red Hat 9 and try to use its up2date utility to apply patches to a fresh installation, you get errors due to an expired SSL certificate. To receive these updates, download the RPMs from this page and install them.

  • Finding Recently Installed RPM packages
    • As its title state, this page has some handy RPM queries. To find packages installed within the past, say, 14 days, do:
      find /bin -type f -mtime -14 | rpm -qF
    • To list RPMs chronologically by when they were installed, most recent first (the entire command goes on one line):
      rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release} %{installtime:date}\n' | sort -nr +1 | sed -e 's/^[^ ]* //'

  • Setting Format Options in VIM
    • Bascially, this is just a copy the VIM help section about how to set the format options. I can never seem to remember how to set them the way I like them when typing bulleted list text files. I want the bulleted lists to autowrap and keep the automatic indention from line-to-line, but not to insert comment leaders.
      :set fo=tq
      For the VIM help section, do:
      :help fo-table