Make Linux more user friendly with this collection of Bash functions!
They provide commands that should be in Linux by default, or just abbreviations of commands that are provided, but are so commonly used that they deserve a shorter name and/or a set of configurable “sensible” options. When abbreviated command is executed, these predefined options are combined with the actual ones. Also most of the commands send their output to a pager if it doesn't fit the screen.
Collection was made for Debian based Linux (Ubuntu, Mint, ...) with Gnome desktop environment, but most commands will work on any system that has Bash shell and GNU Coreutils installed. For OS X see instructions.
There are currently 211 commands.
$ git clone https://github.com/gto76/standard-aliases $ cd standard-aliases $ ./install
Below is a list of most useful commands. If you want to check out the full list see LIST OF ALL COMMANDS.
||List or display directory contents in pager using short listing format.|
||Print file contents.|
||Print or display text or file in pager.|
||Edit file with vim.|
||Exit bash shell.|
||Open new terminal with same working directory.|
||Print exit code of last command.|
||Print directory structure.|
||Copy directories safely.|
||Move directories safely.|
||Delete directories safely.|
|mk, md, mkdir1||
||Create directory and descend into.|
||Open file with default app.|
||Make file executable or create new bash or python script.|
||Extract archive of any type.|
||Print disk space occupied by file or folder.|
||Locate files on filesystem containing pattern in their names.|
||Execute last command as super user.|
||Run command in background.|
||Print or display with pager lines containing pattern.|
||Print or display with pager numbered lines containing pattern in working and subdirectories.|
||Print available disk space in simplified form.|
||Print internal ip.|
||Print external ip.|
||Ping gateway and google.|
||Print installed and available version of package or command.|
||Describe package or command or find available packages with part of name or command.|
How To Rename Commands
- Check if name is already taken by running:
$ type <name>
.standardrclocated in your home directory and add a new name in front of function's description.
- Save and run:
Usually if function only makes Linux command easier to use, either by using a few “sensible” options, or just by sending output to a pager (if necessary), then it has the same name as command, but with number
1appended at the end. Some examples are:
tree1. Options for this commands are defined at the bottom of
standardrcand can be customized by preference.
rmdirare the only functions that override already existing commands. They are all run in interactive mode, meaning you get asked for conformation before any destructive operation. If you want to execute them without this prompting, use
rmdiralso deletes the directory contents.
Command-line completions are automatically assigned to functions, depending on what commands they use.
Commands for accessing the “framework”:
ty COMMAND– prints function's body (short for
rc– opens configuration file (
~/.standardrc) in default editor,
standard_functionsin default editor.
How It Works
After installation the “framework” consists of three files:
standard_functions: It contains Bash functions with long descriptive names. It is located in projects directory.
.standardrcfile: Configuration file that specifies short names for functions. Also defines options that this functions use when they call specific commands. It is located in user's home directory.
aliasesfile: Contains functions with short names that call functions with longer names (as defined in configuration file). It also assigns appropriate command-line completions to the short functions. It is located in
Every time new Bash shell is started, "framework" checks if any changes were made to the functions or configuration file and if so, it generates new
How to run on OS X
- Install Developer Tools by running:
- Install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install GNU Coreutils:
brew install coreutils echo '. .bashrc' >> .profile echo 'PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"' >> ~/.bashrc bash
- Install other GNU programs (optional):
brew tap homebrew/dupes brew install grep --with-default-names brew install findutils --with-default-names brew install tree ...