awk is very complex and hard to learn. It is the most difficult task in Linux administrator's lives and drives everyone crazy who tries to learn it. It's written by Gods and used by them, no mortal man can ever learn awk.
In fact…, no! If you know any C-like programming language and regular expressions, awk is absolutely easy and it can make things much easier. It's pretty mighty, but I've never seen any programming language easier than awk (except QBasic).
File descriptors are very essential in programming. When you open a file, you get a token, which identifies the file instance. With this token you refer to the file, write, read or close it. You have about the same on the shell.
Processes in Linux may run with different priorities so that important processes get more CPU time than less important ones. This priority is called the “nice value” or ”niceness” (NI). The nice value is a number between -20 and +19 with the default value right in the center at 0. The higher this nice value, the “nicer” a process is to others, i.e., the lower its priority.
Performing calculations on the command line is very handy and bc is the tool which does it for you. Also bash can do some calculation stuff, but that's not very intuitive. Bash is built for different things than calculation and so bc is the better choice. It can do much more for you and its syntax is ways easier.
sed is built to process strings (either from STDIN or from a file) line by line. Therefore, you can't search for multiple lines. But there are several ways to work around this. I'll be showing you three ways of performing multi-line replacements.
On Linux devices and their partitions are named automatically when being plugged in. They have a base name (for SCSI devices it's sd), a device identifier (a lowercase letter) and a number for every partition. These names depend on the order in which the devices are plugged in, so they are not static at all.
This is not a tutorial about find in general as you might expect it. find, and the GNU variant in particular, is very complex and can't be covered in one short blog post and actually, there are many good tutorials on the Internet. Instead, this blog post concentrates on one single aspect of find: operators.
You probably know command substitution. Command substitution executes a command and uses its output as a variable on the shell. The operator for this is either the backtick operator. But did you also know that there is a counterpart of command substitution? This counterpart is called process substitution.
You've probably heard of lsof and fuser. Since on UNIX systems everything is a file, these tools are absolutely important to know for each system administrator. They can make your work easier and they can also help identifying attacks on your system.
If you work on remote servers via SSH and don't want to open multiple connections, or if you don't have a graphical terminal emulator and don't want to open several concurrent ttys, screen is the right tool for you.
Vi and its successor vim are both very mighty and well known tools. Some love them, some hate them. But overall, they're complex. If you are about to learn vim, it's probably a good idea to have a well arranged cheat sheet or reference card of the most important keyboard commands. It's not very difficult to find one, there are hundreds of thousands of cheat sheets, but many consist of HTML tables and are ugly or confusing. Only a few are really suitable for printing and having them on the desk
After upgrading your web server you need to restart it, but how is this done correctly? Just killing the server would interrupt all connections and that could cause problems such as inconsistent data and angry users. So what we need to do is to restart the web server gracefully so that all connections being served can finish. Once all connections are closed, the server restarts.