BashStyle-NG 7.9.1 Doc / Chapter 8

## Chapter 8: BS-NG Functions

Note: inlcude functions with \$(function) into your prompt!
Note: each function has a help message `function --help'.

### Until BashStyle-NG 7.7:

### BS-NG-Echo

This function will "parse" the Colorcodes, to make them usable with `echo'.

echo -e $usercolor hello | See - doesn't work correctly.
echo -e $(bs-ng-echo $usercolor) hello | See - this does work now.

### BS-NG-Profiler

This script will import or export your current configuration.

bs-ng-profiler | export |  | Export your profile into a plain-text file.
| import | a saved profile | Import an already saved profile.

### Countfiles

This function will show how many files/folders are in the current directory.

count_files | +h | Count files, folders (and hidden ones).
| -h | Count files, folders (no hidden ones).
| -d | Count folders (no hidden ones).
| +d | Count folders (and hidden ones).
| -f | Count files (no hidden ones).
| +f | Count files (and hidden ones).

### Count Processes

This function counts all running processes.

count_processes | no options.

### Show-Battery-Load

This function will show your lappy's battery load, using APM.

show_battery_load | acpi | use acpi for getting batteryload.
| apm | use apm for getting batteryload.

### Show-CPU-Load

This function will show your CPU load.

show_cpu_load | no options.

### Show-System-Load

This function will show your system load.

show_system_load | 1 | Load average for 1 minute.
| 10 | Load average for 10 minutes.
| 15 | Load average for 15 minutes.

### Show-Memory

This function will show your memory load.

show_mem | --used | Shows used memory in MB.
| --used-percent | Shows used memory in Percent.
| --free | Shows free memory in MB.
| --free-percent | Shows free memory in Percent.

### Show-Size

This function will show the size of all files in the current directory.

show_size | no options.

### Show-Space

This function will show your disk space.

show_space | --used | mountpoint | Shows the used space in MB/GB.
| --used-percent | mountpoint | Shows the used space in Percent.
| --free | mountpoint | Shows the free space in MB/GB.
| --free-percent | mountpoint | Shows the free space in Percent.
| --total | mountpoint | Shows the total space in MB/GB.

### Show-TTY

This function shows the current TTY (Terminal Device).

show_tty | no options.

### Show-Uptime

This function will show your system's uptime.

show_uptime | no options.

### TruncPWD

This function will print a modified version of $PWD.

trunc_pwd | no options.

### Show-IP

This function will show your external ip address.

show_ip | <interface> | show external ip address of <interface>.

### Man 2 PDF

This function will convert a manpage to a pdf file.

man2pdf <manpage> | convert <manpage> into a pdf.

### System-Infos

This function will show serveral system informations.

system_infos | --cpu | Display CPU Model and Frequency.
| --kernel | Display Kernel Release, Version and Machine.
| --memory | Display Total, Free and Used RAM.
| --partitions | Display Major, Minor, Blocks and Node for all recognized paritions.
| --pci | Display Infos about all PCI Devices (and their kernel-module).
| --usb | Display Infos about all USB Devices (and their kernel-module).
| --bios | Display SMBIOS/DMI Informations.
| --mounts | Display all mounted devices.

### RCGenerator

This script will generate standalone rc-files.

rcgenerator | --bash | Generate standalone bashrc.
| --readline | Generate standalone inputrc.
| --vim | Generate standalone vimrc.
| --nano | Generate standalone nanorc.
| --all | Generate standalone rcs for all four.

### New in BashStyle-NG 7.8:

### xchown

Recursive chown for given user, with root priviledges, via su.

xchown | USER | FILES/FOLDERS

### xmv

Move files to last arguement, if that directory does not exist, create it before moving.

xmv | FILE FILE FILE FILE DESTINATION

### xcp

Same than xmv, but for copying instead of moving.

xcp | FILE FILE FILE FILE DESTINATION

### xdel

Delete matching files recursively (also: `rm of doom').

xdel | pattern

### xconv

Xconv is a set of functions for converting numbers.

bin2oct | convert binary to octal.
bin2dec | convert binary to decimal.
bin2hex | convert binary to hexadecimal.
bin2all | convert binary to all three.
oct2bin | convert octal to binary.
oct2dec | convert octal to decimal.
oct2hex | convert octal to hexadecimal
oct2all | convert octal to all three.
dec2bin | convert decimal to binary.
dec2oct | convert decimal to octal.
dec2hex | convert decimal to hexadecimal.
dec2all | convert decimal to all three.
hex2bin | convert hexadecimal to binary.
hex2oct | convert hexadecimal to octal.
hex2dec | convert hexadecimal to decimal
hex2all | convert hexadecimal to all three.
round | round a decimal.
radical | get the square-root of a decimal.
power | get the n-th power of a decimal.

### xunalias

Xunalias is a replacement for unalias, which does not err if an alias
can't be unaliased (usefull for scripts).

xunalias | alias

### ls functions

A set of extra `ls' variants.

ll | show detailed infos.
la | also display hidden files.
l1 | display one file per line.
lo | display owner of file.
lg | display group of file.
lm | display mode of file.

### git functions

A set of extra `git' functions.

git_export | PATH | export the git-tree to PATH.
git_bzip |  | create bzip2-compressed tarball from the git-tree.

### exchange

Exchange the value of two variables.

exchange | VARIABLE1 | VARIABLE2

### New in BashStyle-NG 7.9:

### random

Print a random number.

random | maximum | Print a random number from 0 to maximum.

### New in BashStyle-NG 7.9.1:

### ps

A set of `ps' related functions

psgrep | -u | USER | Print all processes belonging to USER
|  | PROCESSNAME | Print all running processes matching PROCESSNAME

pskill | PROCESSNAME |  | psgrep for PROCESSNAME and ask for a process to kill
pskill | PROCESSNAME | SIGNAL | psgrep for PROCESSNAME and ask for a process to kill via signal SIGNAL

Chapter 7 | Index | Chapter 9