john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Bash scripts defined

chmod 050


.BASHRC

enable color support of ls and also add handy aliases

if [ "$TERM" != "dumb" ]; then eval "dircolors -b" alias ls='ls --color=auto' #alias dir='ls --color=auto --format=vertical' #alias vdir='ls --color=auto --format=long' fi

some more ls aliases

alias ll='ls -la' alias nano='nano -S'

export PATH=$PATH:~/bin


!/bin/bash -x

WHATSINSTALLED.SH

dpkg --get-selections > /bin/date +%Y-%m-%d--%H-%M-installed-software.txt

-x will display all variables and commands before executing them


!/bin/bash

WHOLAST.SH

who -u echo last | head -n 7


!/bin/bash

TOSCRIPT.SH

chmod 750 $1

Use [[ -v foobar ]] for variables in Bash version >= 4.2.

if [[ -v foobar ]]; then echo "foobar is set, foobar=$foobar" else echo "foobar is not set" fi


  • « Continuous integration bamboo on ubuntu 14.04 with tomcat7 libapr
  • Mysql left join inner join outer join »

Published

Aug 7, 2014

Category

linux

~102 words

Tags

  • bash 7
  • defined 2
  • scripts 63