background preloader

Heiner's SHELLdorado

Heiner's SHELLdorado

Bash Prompts This web page is a child of the Bash Prompt HOWTO that I'm maintaining for the Linux Documentation Project. The HOWTO explains a lot more than I'm going to here. My interest in Bash Prompts developed when I found "The BashPrompt Themes Project (now long deceased). Some of their prompts show up here, and a lot of what I've done shows the influence of their work. I started these pages because so many people have been mailing me cool prompts that I couldn't see putting them all in the HOWTO as examples, but I thought they ought to be available to give other people ideas. Stock RedHat 5.1 Prompt A point of reference. Stock Suse Prompt Another reference. Dan's Prompt A long-time tcsh user, Dan's prompt includes the history number, the tty number, and the return value of the last run process. Jobs Prompt Keeping track of suspended jobs. A Light-weight Prompt Uses colours and fairly standard information. Elite2 Prompt Cyan ASCII art VGA only prompt from the BashPrompt Themes package. Tonka2 Prompt

GUI scripting with Zenity One advantage to using Linux is that there is a plethora of powerful commands available on the command-line; however, many users prefer not to use the CLI or are intimidated by it. Some users simply prefer to use a GUI. With a program like Zenity, you can use both. Zenity is a tool that allows you to create GUI prompts for shell scripts. Similar to the dialog tool, which creates nice "graphical" text interfaces for the CLI, Zenity creates GUI widgets and windows that can be used in a shell script. For example, to simply have Zenity pop up an error window, you would use: zenity —error —text="An error occurred\!" Here Zenity is told to create an error window with the —error command, that the text to be displayed in the window is "An error occurred!" Using the —help argument will get a list of the various commands Zenity can take. #! zenity —info —title="Demo Progress Script" —text="This script shows how Zenity creates a progress bar." #! zenity —question —text="Do you wish to continue/?" rc=$? fi

ShellEd | Download ShellEd software for free How To Use awk In Bash Scripting How do I use awk pattern scanning and processing language under bash scripts? Can you provide a few examples? Awk is an excellent tool for building UNIX/Linux shell scripts. AWK is a programming language that is designed for processing text-based data, either in files or data streams, or using shell pipes. In other words you can combine awk with shell scripts or directly use at a shell prompt. This pages shows how to use awk in your bash shell scripts. Print a Text File awk '{ print }' /etc/passwd OR awk '{ print $0 }' /etc/passwd Print Specific Field Pattern Matching You can only print line of the file if pattern matched. If no pattern is given, then the action applies to all lines. Print Lines Containing tom, jerry AND vivek Print pattern possibly on separate lines: awk '/tom|jerry|vivek/' /etc/passwd Print 1st Line From File awk "NR==1{print;exit}" /etc/resolv.conf awk "NR==$line{print;exit}" /etc/resolv.conf Simply Arithmetic Call AWK From Shell Script AWK and Shell Functions Awk Program File

man bash - Interpréteur de commandes GNU Bourne-Again SHell. REFERENCEoutdated.inc.7See outdated.inc.7 bash - Interpréteur de commandes GNU Bourne-Again SHell. outdated.inc.7 See outdated.inc.7 Bash est un interpréteur (Shell) compatible sh qui exécute les commandes lues depuis l'entrée standard, ou depuis un fichier. Bash est conçu pour être conforme aux spécifications IEEE concernant les shells et les outils Posix (Groupe de travail de l'IEEE 1003.2). En plus des caractères d'options documentés dans la description de la commande interne set, bash accepte les arguments suivants lorsqu'on l'invoque : -c chaîne Si l'argument -c est présent, les commandes sont interprétées depuis la chaîne fournie. -r Si l'option -r est présente, l'interpréteur est restreint (voir SHELLS RESTREINTS plus bas). -i Si l'option -i est présente, l'interpréteur est interactif. -s Si l'option -s est présente, ou s'il n'y a plus d'arguments sur la ligne de commande, après le traitement des options, l'interprétation se fera depuis l'entrée standard. Bash reconnaît également plusieurs options multi-caractères. --dump-strings

Stupid cat Tricks: Mike Chirico Stupid "cat" tricks that work. The "cat" command is very powerful and fast. These may be some tips the contents of multiple files from one list. These tips are simple, fast and worth a quick look. shortened. $ cat -v mout|tail test M-v test M-w test M-x test M-y test M-z test M-{ test M-| test M-} test M-~ test M-^? In nearly all cases $ cat file | some_command and its args ...can be rewritten as: $ <file some_command and its args ... Linux System Admin Tips: There are over 200 Linux tips and tricks in this article. Linux Quota Tutorial: This tutorial walks you through implementing disk quotas for both users and groups on Linux, using a virtual filesystem, which is a filesystem created from a disk file. Breaking Firewalls with OpenSSH and PuTTY: If the system administrator deliberately filters out all traffic except port 22 (ssh), to a single server, it is very likely that you can still gain access other computers behind the firewall. Working With Time: What?

mmv MAN Page Mass Move and rename - Move, copy, append or link Multiple files using wildcard patterns. Syntax mmv [Source_Option] [-h] [-d|p] [-g|t] [-v|n] [--] [from to] Options: -h help -d Delete -p Protect (don't delete or overwrite) -g Go -t Terminate -v verbose mode -n no-execute mode (display messages about what would have been done) Source_Options: -m Move source file to target name. Both must be on the same device. Will not move directories. If the source file is a symbolic link, moves the link without checking if the link's target from the new directory is different than the old. Mmv moves (or copies, appends, or links, as specified) each source file matching a from pattern to the target name specified by the to pattern. This multiple action is performed safely, i.e. without any unexpected deletion of files due to collisions of target names with existing filenames or with other target names. mmv does support large files (LFS) but it does *NOT* support sparse files (i.e. it explodes them).

Finding Files - Actions Go to the first, previous, next, last section, table of contents. There are several ways you can print information about the files that match the criteria you gave in the find expression. You can print the information either to the standard output or to a file that you name. You can also execute commands that have the file names as arguments. You can use those commands as further filters to select files. Print File Name Action: -print True; print the full file name on the standard output, followed by a newline. Action: -fprint file True; print the full file name into file , followed by a newline. Print File Information Action: -ls True; list the current file in `ls -dils' format on the standard output. 204744 17 -rw-r--r-- 1 djm staff 17337 Nov 2 1992 . The fields are: The inode number of the file. Action: -fls file True; like `-ls' but write to like `-fprint' (see section Print File Name). Action: -printf format True; print on the standard output, interpreting `\' escapes and `%' directives. \a \b k

Sed - An Introduction and Tutorial Quick Links - NEW Table of Contents Copyright 1994, 1995 Bruce Barnett and General Electric Company Copyright 2001,2005,2007,2011,2013 Bruce Barnett All rights reserved You are allowed to print copies of this tutorial for your personal use, and link to this page, but you are not allowed to make electronic copies, or redistribute this tutorial in any form without permission. Original version written in 1994 and published in the Sun Observer How to use sed, a special editor for modifying files automatically. There are a few programs that are the real workhorse in the UNIX toolbox. Sed is the ultimate stream editor. Anyhow, sed is a marvelous utility. Do not fret! Sed has several commands, but most people only learn the substitute command: s. sed s/day/night/ <old >new Or another way (for UNIX beginners), sed s/day/night/ old >new and for those who want to test this: echo day | sed s/day/night/ This will output "night". I didn't put quotes around the argument because this example didn't need them. or

Related: