Skip to content

gregorgorjanc/GorjancShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7161213 · Feb 23, 2025

History

63 Commits
Nov 22, 2016
Aug 25, 2024
Feb 23, 2025
Sep 8, 2024
Sep 20, 2024
Nov 22, 2016
Mar 10, 2024
Jun 9, 2021
Feb 6, 2017
Nov 22, 2016
Feb 24, 2024
Nov 22, 2016
Feb 24, 2024
Feb 24, 2024
Sep 9, 2024
Sep 9, 2024
Sep 10, 2024
Sep 12, 2024
Sep 14, 2024
Sep 15, 2024
Sep 20, 2024
Sep 20, 2024
Feb 23, 2025
Feb 6, 2018
Nov 21, 2016
Nov 21, 2016
Nov 21, 2016
Nov 22, 2016
Nov 21, 2016
Nov 21, 2016
Nov 21, 2016
Nov 21, 2016
Nov 21, 2016

Repository files navigation

Gorjanc Shell

Gregor Gorjanc's shell functions and scripts

Description

A set of functions and scripts that make my life easier when working in shell/terminal. These are not necesarilly bomb proof, but do the job. Feel free to improve them!

The functions/scripts are:

  • cpumemlog - monitor CPU and RAM usage
  • cwdiff - color word diff
  • browse - open file browser application from working folder
  • dim,nrow,ncol - number of rows and columns in an rectangular file
  • find* - find files and folders quickly
  • func - print out a function
  • hi - search in the .history file
  • open - my attempt at generic file opener from the terminal
  • psu,psux - find user's processes and where they are running
  • remove_header - remove first row in a file
  • repeat - repeat something
  • rmd,cld,... - various remove functions
  • rows,cols - print a subset of rows and cols
  • see,see_col,head_col,tail_col - print few rows of a file
  • server - generate a set of aliases for a set of servers
  • qstat*,qdelall - manipulate SGE cluster jobs
  • stop,reboot - stop and reboot computer
  • sys_info - retrieve system information (RAM, processors, disk, ...)
  • x2y - convert files from one type to another
  • tarc,tarx,zipc,zipx - (un)compress a given folder
  • grepall - grep recursively
  • pwdx - print working directory of a process
  • qwc - quick wc
  • spaces - replace filename spaces with _

Installation

Functions are stored in files named func_foo.sh while scripts are stored in files named foo.

  1. Save the files in your ~/bin folder or clone repo and link the files to ~/bin or elsewhere
  2. Add /bin folder to your PATH variable, i.e., export PATH=/bin:$PATH
  3. In order to be able to use functions, add the following code to your ~/.bashrc file for each function you want to use:
if [ -f ~/bin/func_foo.sh ]; then
  source ~/bin/func_foo.sh
fi

or for a set of functions:

FUNCS="func_foo1.sh
       func_foo2.sh"
for FILE in ${FUNCS}; do
  if [ -f "~/bin/${FILE}" ]; then
    source ~/bin/${FILE}
  fi
done