• Stars
    star
    104
  • Rank 321,067 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Attempt at defining a standard extension to Linux in form of Bash functions

Standard Aliases

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 macOS see instructions.

There are currently 211 commands.

How to…

Install

$ git clone https://github.com/gto76/standard-aliases
$ cd standard-aliases
$ ./install

Uninstall

$ ./uninstall

Commands

Below is a list of most useful commands. If you want to check out the full list see LIST OF ALL COMMANDS.

Basic

Name Runs Description
p if [[ $# -eq 0 ... Print working directory or path to file.
l ___displayOutpu... List or display directory contents in pager using short listing format.
la __listOrDisplay... List or display all directory contents in pager using short listing format.
ll ___displayOutpu... List or display directory contents in pager using long listing format.
lla __listOrDisplay... List or display all directory contents in pager using long 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.

Directories

Name Runs Description
mk, md, mkdir1 mkdir --parents... Create directory and descend into.
cpdir cp --interactiv... Copy directories safely.
mvdir mv --interactiv... Move directories safely.
rmdir rm --interactiv... Delete directories safely.

Useful

Name Runs Description
extract if [ -z "$1" ];... Extract archive of any type.
o, openFile __runCommandInB... Open file with default app.
rb, runInBackground nohup "$@" &>/d... Run command in background.
me, makeExecutable if [[ ! -f "$1"... Make file executable or create new bash or python script.
lo, locate1 locate "$1" </code>... Locate files on filesystem containing pattern in their names.
grr __printLinesCon... Print or display with pager numbered lines containing pattern in working and subdirectories.

Git

Name Runs Description
gs git -c color.st... Print short repository status.
gd git diff "$@" Display changes between commits.
gl git log --graph... Display minimal log of commits.
commit git commit -am ... Commit changed and deleted files with message.
push git push "$@" Push changes to remote repository.
pull git pull "$@" Pull changes from remote repository.

Networking

Name Runs Description
pa, pingAll ping -c 1 -q $(... Ping gateway and google.
ip1 /sbin/ifconfig ... Print internal ip.
ip2 lynx --dump htt... Print external ip.
gateway route -n </code>... Print gateways ip.

Packages

Name Runs Description
update sudo apt-get up... Update information about available packages.
ch, canhaz if [[ "$__stand... 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.

How To Rename Commands

  • Check if name is already taken by running: $ type <name>
  • Open .standardrc located in your home directory and add a new name in front of function's description.
  • Save and run: $ bash

Misc

  • 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 of standardrc and can be customized by preference.

  • cp, mv, rm and rmdir 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 for type),
    • rc – opens configuration file (~/.standardrc) in default editor,
    • fu – opens standard_functions in 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.

  • User's .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.

How to run on macOS

  • 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
...

More Repositories

1

python-cheatsheet

Comprehensive Python Cheatsheet
Python
32,714
star
2

linux-cheatsheet

Comprehensive Linux Cheatsheet
Shell
654
star
3

comp-cpp

Comp Mark I – Simple 4-bit virtual computer
C++
336
star
4

comp-m2

Comp Mark II – Simple 4-bit virtual computer
C++
170
star
5

bets

Betting odds scraper for multiple bookies
HTML
35
star
6

my-linux-setup

My Linux configuration files and text-files with notes on Linux subjects
HTML
15
star
7

wfdl

Watch Face Description Language
Python
13
star
8

face-tracker

Face tracking using openCV
Java
10
star
9

gto76.github.io

Homepage
HTML
9
star
10

race

Terminal racing game
C
9
star
11

advent-of-code-2020

Solutions to Advent of Code 2020
HTML
9
star
12

ascii-git-graph-to-png

ASCII Git graph renderer
Shell
8
star
13

js-music-player

HTML5 + jQuery + D3.js
HTML
8
star
14

fun-photo-time

Image filtering fun for everyone!
Java
8
star
15

betbrain-scraper

HTML
8
star
16

online-go-games

Records of go games
7
star
17

advent-of-code-old

Python
5
star
18

from-singularity-to-morality

TeX
5
star
19

wolfram-cells

Wolfram random patterns generator
Scala
4
star
20

tanks

Two player game
C
4
star
21

albums

37 Greatest Albums of All Time
HTML
3
star
22

SolrJ-Utility-Stuff

Utility functions for SolrJ
Java
3
star
23

foto-scripts

Bash scripts for cropping and adding borders
Shell
3
star
24

odd-rules

Betting assistant that searches for correlations between stats and betting odds
D
3
star
25

genome

Bash Scripts For DNA Analysis
Shell
3
star
26

basket-stats

Basketball stats recorder
Java
3
star
27

history-of-popular-music

JavaScript
3
star
28

comp

Simple virtual computer with assembler
Scala
3
star
29

essence-of-singularity

HTML
2
star
30

best-songs

25 Greatest Songs of All Time
HTML
2
star
31

the-library-of-the-babel

Image of an Overpopulated Universe
HTML
2
star
32

bicikl-pp

Public bicycle availability Android app for Ljubljana
Java
1
star
33

race-go

Curses racing prototype in golang
Go
1
star
34

go-game-utils

Utility scripts for analysis of go games
C
1
star
35

church

Minecraft Pi project
1
star
36

fri

Poor man's wiki
HTML
1
star
37

photos

Six photographs I am not ashamed of :)
HTML
1
star
38

living-room

Blender project
1
star
39

n-in-the-row

N in the row AI
Python
1
star
40

bit8-compiler

Compiler for simple 8-bit assembler
Scala
1
star