Bash/Shell Resources/CLI
< Linux
Get flash to fully experience Pearltrees
Bash history is very powerful. Understanding how to effectively use the bash history expansions will make you extremely productive on the Linux command line. Word designators – Refers to a particular word of a history entry. Typically this gets combined with an even designator. Even designators and word designators are separated by a colon
Data loss will be costly. At the very least, critical data loss will have a financial impact on companies of all sizes. In some cases, it can cost your job. I’ve seen cases where sysadmins learned this in the hard way. There are several ways to backup a Linux system, including rsync and rsnapshot that we discussed a while back.
Bash has several commands that comes with the shell (i.e built inside the bash shell). It exports a variable or function with a value. “env” command lists all the environment variables. In the following example, you can see that env displays the exported variable. eval command combines all the given arguments and evaluates the combined expression and executes it, and returns the exit status of the executed command. $ cat evalex.sh if [ !
There are two types of bash for loops available. One using the “in” keyword with list of values, another using the C programming like syntax. Bookmark this article for future reference, as this is the only article you would ever need to refer on how to use bash for loops with examples. “list” contains list of values. The list can be a variable that contains several words separated by spaces.
Fail2ban scans log files (e.g. /var/log/apache/error_log ) and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. Generally Fail2Ban then used to update firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary other action (e.g. sending an email, or ejecting CD-ROM tray) could also be configured. Out of the box Fail2Ban comes with filters for various services (apache, curier, ssh, etc). 2009/09/07 More than 1 year after 0.8.3, here is 0.8.4 and...
Functions A function can help you modularize your script. Because the function is executed in the context of the same shell, it does not create a new child process, this makes functions faster as they access the information in RAM.
So how do you setup, change and pimp out Linux / UNIX shell prompt? Most of us work with a shell prompt. By default most Linux distro displays hostname and current working directory. You can easily customize your prompt to display information important to you.
In order to write DVD/DVD-RW from shell prompt you need to install a package called dvd+rw-tools. DVD is another good option for backup, archiving, data exchange etc. You can install dvd+rw-tools with following commands. Also note that this package works under *BSD, HP-UX, Solaris and other UNIX like operating systems.
In this lesson, we will explore a powerful feature used by many command line programs called input/output redirection . As we have seen, many commands such as ls print their output on the display. This does not have to be the case, however. By using some special notation we can redirect the output of many commands to files, devices, and even to the input of other commands.
I guess anyone who's administered several remote boxes has had the unfortunate problem of (when not thinking straight) taking down the network card on a machine you have no physical access to. The result being that the ssh session you used to connect dies. The typical mistake is to do something like (as root):