Ever run a shell script and get the following error?
# ./dosfile.sh : bad interpreter: No such file or directory The error may look like there is a problem with your scripts SHEBANG where you specify the interpreter, so you go look and the line contains #!/bin/bash which is correct. So then you start wondering if there is a problem with the /bin/bash binary, and all sorts of thoughts of what would happen if /bin/bash was missing or broken start racing through your head....
Shell scripting is a fundamental skill that every systems administrator should know. The ability to script mundane & repeatable tasks allows a sysadmin to perform these tasks quickly. These scripts can be used for anything from installing software, configuring software or quickly resolving a known issue.
A fundamental core of any programming language is the if statement. In this article I am going to show several examples of using if statements and explain how they work....
Before the advent of a distributed domain name system; networked computers used local files to map hostnames to IP addresses. On Unix systems this file was named /etc/hosts or “the hosts file”. In those days, networks were small and managing a file with a handful of hosts was easy. However as the networks grew so did the methods of mapping hostnames and IP addresses.
In modern days with the internet totaling at somewhere around 246 million domain names (as of 2012) the hosts file has been replaced with a more scalable distributed DNS service....
One of the things that excited me while learning Unix/Linux was how quickly one can perform tasks via the command line. Bash is a fully functional scripting language that incorporates Variables, Loops and If/Then statements; the bash shell allows a user to use these functions while performing adhoc tasks via the command line. This is also true for the other common shells such as bourne, korn shell, and csh.
Below I will show 5 example for loops that are run on the command line without being placed into a shell script....
Nice is a command in Unix and Linux operating systems that allows for the adjustment of the “Niceness” value of processes. Adjusting the “niceness” value of processes allows for setting an advised CPU priority that the kernel's scheduler will use to determine which processes get more or less CPU time. In Linux this niceness value can be ignored by the scheduler, however other Unix implementations can treat this differently.
Being able to adjust the niceness value comes in handy in two scenarios usually....