• bash scripting how to create a function

    function centos7 { release=`cat /etc/redhat-release|awk '{print $4}'|grep ^[7]` if [ "$release" != "" ]; then centos7='yes' fi } centos7 echo "$centos7" We create a function called "centos7" and then call it by just typing "centos7" We then access a variable that may be set........
  • PHP Displaying Blank Page on Apache

    Almost always the reason will be that the php.so file is missing but also that php.conf is misconfigured. In the problem machine it is actually PHP7 installed so if you reference PHP5 of course things wil be broken! Take for example here: cat /etc/httpd/conf.d/php.conf # # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamica........
  • mail command line examples of how to send an email using Linux / Unix and the Bash Shell or Scripting

    A simple way that may work for a lot of people who just need basic output for their scripts or daemons to announce an action is this: echo "body or message" | mail -s "realtechtalk.com" user@domain.com If you want to send a text file as the body just do this instead: mail -s "realtechtalk.com" user@domain.com < /tmp/sometxtfile.txt These are some ve........
  • zip warning: name not matched: in Linux Solution

    There are usually two reasons for this. #1 The most common is that you need to enable the -r (recursive) flag with zip to make it recurse into directories. So the solution is to use -r zip -r somefile.zip yourfiles #2 If you are using bash scripting based on ls without the full path or for some other reason the full path is missing, zip looks for the files in the current directory so this will always fail.........
  • bash scripting for loop set number of iterations

    A handy trick in bash that can be adapted to many useful tasks: for i in {1..99}; do echo $i done 1 2.. 97 98 99 100 Another tricky is if you need a 0 in front of the first letters: for i in {1..12}; do if [ $i -lt 10 ]; then i=0"$i" fi echo $i........
  • bash script check if file exists

    It is very simple and like this to test for the existence of file using bash scripting: if [ -f /etc/somefile ]; then echo "yes it exists" fi........
  • Linux bash how to list files of a certain date with the statu command for scripting

    The command below will show only files created for the month of 2014-12 but you can of course change the year, month or even specific day or time to suit your needs. The awk command simply just makes it output the list of files created on the date you are looking for. stat -c "%z %n" *|grep ^"2014-12"|awk '{print $4}'........
  • CPanel Link to all of the command line options

    CPanel says you can access 98% of the functions through CLI which experienced Unix/Linux admins prefer for simplicity and for scripting.  I've never found CPanel easy to use from the admin panel, it seems everything is hard to find and a simple task becomes a series of hunts. So for people like me here's the list: http://cpanel.net/system-administrators/command-line-scrip........
  • bash Linux basename and directory name, get the actual directory and file

    Example: basename /var/log/messages messages As shown above the "basename" utility gives you the end filename separately. dirname /var/log/messages /var/log As shown above the "dirname" utlity gives you just the utility even if you pass it a specific file. The above two utilities are very helpful in Bash scripting when working with files and directories co........
  • encrypt bash scripts to hide source code

    http://www.datsi.fi.upm.es/~frosal/ SHC is a program written by the author above that does just that, it's a great little tool to have. Some have said it isn't exactly encrypting the code but just making it hard to read by obfuscating the code. There was also a good discussion about that here:........
  • Walmart.ca & Ubuntu Caused Xorg 100% CPU usage

    I can't tell if it's Flash or Javascript that they were using, but it basically caused my sysetm to lockup until I closed that one page. Is this proof enough that Wal-mart is evil?:) I've never seen that before, it's weird how certain things mask themselves as high CPU usage with Xorg, unless it is some kind of weird Xorg problem but I believe it's more of a Flash/Javascript issue from Firefox in Wal-mart's evil scripting.........
  • PDF File Conversion/Solution Using Imagemagick to create PDF files for free, quickly and efficiently

    I'm really starting to love ImageMagick, I've used it to mass convert/resize family photos with scripts and all kinds of handy things. Today I just learned that you can create PDF files with it too, say if you have images scanned or anything else it's very simple: convert *.jpeg output.pdf You can replace jpg with whatever format your files are in. One thing to remember is that you can specify the order that the images/pages are added to the PDF manu........
  • Bash Script Info

    Bash Script Infohttp://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html#ss10.5 http://www.scit.wlv.ac.uk/~jphb/spos/notes/shell/shell5.html http://quong.best.vwh.net/shellin20/#LtohTOCentry-41 http://www.cactus.org/~dak/shellscript.html http://db.ilug-bom.org.in/Documentation/abs-guide/ http://pegasus.rutgers.edu/~elflord/unix/bash-tute.html http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/CShellII.html Since bash i........
  • Bash Scripting Variable Scope Using Piped While Loop

    I've been struggling with this for awhile, wondering why all of my variables are null. Ijust realized the variables disappear after leaving this while loop. Note that I'm piping to the while loop which makes a subshell Ibelieve which is the cause of the issue: echo "$accounts"|while read thisline; do somevariable="some value" (( ++counter )) done At all costs you ne........
  • Writing/Burning a data CD-R/DVD-R or DVD+RW in Unix/Linux

    There's a lot of outdated information and confusion for system administrator's out there. One annoying task for many an Administrator has been backing up data in Linux. You don't need any GUI tools such as K3B or GnomeBaker. Both are excellent tools but for veteran command line users working remotely, using the keyboard is a great and possibly automated way to save yourself pain and hassle. At a later date we'll cover how scripting can automatically backup certain........
  • Latest Articles

  • CentOS 6 impossible to compile a newer libguestfs
  • chroot
  • How To Get Started on Ubuntu with gpt-2 OpenAI Text Prediction
  • Remove cloud-init in your VM
  • QEMU-KVM KVM Command Line Practical Guide
  • Linux How To Change NIC Name to eth0 instead of enps33 or enp0s25
  • virt-resize: error: libguestfs error: could not create appliance through libvirt.
  • Asterisk Does Not Retry When Authentication Fails
  • Linux Debian Ubuntu How To Install PEPPER Faster and Latest Adobe Flash Player in Firefox
  • How To Speed Up Linux Ubuntu and Debian Based Computers By Improving CPU Performance and Changing the CPU Governor
  • Convert data or file to base64 on a single line
  • Linux Mint Ubuntu Debian radeon slow 2D performance issues radeon_dp_aux_transfer_native: 158 callbacks suppressed
  • mdadm: super0.90 cannot open /dev/sdb1: Device or resource busy mdadm: /dev/sdb1 is not suitable for this array.
  • How To Install NextCloud on Centos 7 and Centos 8
  • AH01630: client denied by server configuration:
  • ERROR: Could not find a version that satisfies the requirement PIL (from versions: none) ERROR: No matching distribution found for PIL
  • ZTE Camera Cannot Work unable to connect to camera. Camera has been disabled becaue of security policies or is being used by other apps
  • QEMU KVM how to boot off a physical CD/DVD/BDROM Drive
  • How To Install OpenProject on Centos 7 Step-by-Step Guide
  • Ubuntu Debian Linux Cannot Install Wine Solution - wine1.6 : Depends: wine1.6-i386 (= 1:1.6.2-0ubuntu14.2) but it is not installable wine1.4 : Depends: wine1.6 but it is not going to be installed