Make Linux more user friendly with this collection of Bash functions.
It provides commands that should be in Linux by default, or just an abbreviations of commands that are provided, but are so commonly used that they deserve a shorter name.
Collection was made for Debian based Linux (Ubuntu, Mint, ...) with Gnome desktop environment, but most commands will work on all systems with installed Bash shell and GNU Coreutils. For OS X see instructions.
There are currently 209 commands.
$ git clone https://github.com/gto76/standard-aliases
$ cd standard-aliases
$ ./install
$ ./uninstall
Below is a list of most useful commands. If you want to check out the full list see LIST OF ALL COMMANDS.
Name | Runs | Description |
---|---|---|
l | ___displayOutpu ... |
List or display directory contents in pager using short listing format. |
e | echo "$@" |
Print text. |
c | cat "$@" |
Print file contents. |
m | ___printOrDispl ... |
Print or display text or file in pager. |
v | vim -p "$@" |
Edit file with vim. |
q | exit |
Exit bash shell. |
te, terminal | x-terminal-emul ... |
Open new terminal with same working directory. |
? | echo $? |
Print exit code of last command. |
Name | Runs | Description |
---|---|---|
t, tree1 | tree -C -I .git ... |
Print directory structure. |
cpdir | cp --interactiv ... |
Copy directories safely. |
mvdir | mv --interactiv ... |
Move directories safely. |
rmdir | rm --interactiv ... |
Delete directories safely. |
mk, md, mkdir1 | mkdir --parents ... |
Create directory and descend into. |
bk, backup | sudo cp --prese ... |
Backup file. |
o, openFile | __runCommandInB ... |
Open file with default app. |
me, makeExecutable | if [[ ! -f "$1" ... |
Make file executable or create new bash or python script. |
extract | if [ -z "$1" ]; ... |
Extract archive of any type. |
du1 | du --summarize ... |
Print disk space occupied by file or folder. |
lo, locate1 | locate "$1" \ ... |
Locate files on filesystem containing pattern in their names. |
Name | Runs | Description |
---|---|---|
f, fuck | sudo $(history ... |
Execute last command as super user. |
rb, runInBackground | nohup "$@" &>/d ... |
Run command in background. |
gr | __printLinesCon ... |
Print or display with pager lines containing pattern. |
grr | __printLinesCon ... |
Print or display with pager numbered lines containing pattern in working and subdirectories. |
df1 | `df -h | grep "s[** ...`**](standard_functions#L1165-L1167) |
ip1 | /sbin/ifconfig ... |
Print internal ip. |
pa, pingAll | ping -c 1 -q $( ... |
Ping gateway and google. |
Name | Runs | Description |
---|---|---|
ch, canhaz | sudo apt-get in ... |
Install package. |
ve, version | # Check if pass ... |
Print installed and available version of package or command. |
wi, whatis1 | # Checks if it ... |
Describe package or command or find available packages with part of name or command. |
- Check if name is already taken by running:
$ type <name>
- Open
.standardrc
located in your home directory and add new name in front of function's description. - Save and run:
$ bash
-
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
1
appended at the end. Some examples are:ps1
,mkdir1
,pgrep1
,tree1
. Options for this commands are defined at the bottom ofstandardrc
. -
cp
,mv
,rm
andrmdir
are 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-f
(force) option.rmdir
also 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 fortype
),rc
– opens configuration file (~/.standardrc
) in default editor,fu
– opensstandard_functions
in default editor,ba
– starts new Bash shell (short forbash
).
After installation the "framework" consists of three files:
-
standard_functions
: It contains Bash functions with long descriptive names. It is located in projects directory. -
Users
.standardrc
file: 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. -
Automatically generated
aliases
file: 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~/.standard_aliases
directory.
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 aliases
file.
- Install Developer Tools by running:
make
- 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
...