Indicate how each name would be interpreted if used as a command name

$type -a locate locate is /usr/bin/locate $type -a ls ls is aliased to `ls –color=auto’ ls is /bin/ls $type -t ls alias $type -t locate file $type -t /dev/urandom $type -t /dev/sda1 $type -t urandom $type -t sda1 $type -t type builtin $type -t shuf file $type -t bash file $type -t proc $type -t …

Calling an external command in Python

$pwd /home/jeffrin/beautifulwork/github $ls beautifulwork-github.php beautifulwork-github.py $ls -l total 8 -rw-r–r– 1 jeffrin jeffrin 414 Dec 10 2016 beautifulwork-github.php -rw-r–r– 1 jeffrin jeffrin 1300 Dec 10 2016 beautifulwork-github.py $cat ../../ls.py from subprocess import call call([“ls”, “-l”]) $python ../../ls.py total 8 -rw-r–r– 1 jeffrin jeffrin 414 Dec 10 2016 beautifulwork-github.php -rw-r–r– 1 jeffrin jeffrin 1300 Dec 10 …

grep a file, but show several surrounding lines?

$grep -C 1 lambda doowli.py request = urllib2.Request(url) request.get_method = lambda : ‘HEAD’ try: $grep -B 1 -A 0 lambda doowli.py request = urllib2.Request(url) request.get_method = lambda : ‘HEAD’ $grep -B 1 -A 5 lambda doowli.py request = urllib2.Request(url) request.get_method = lambda : ‘HEAD’ try: response = urllib2.urlopen(request) return True except urllib2.HTTPError: return False $grep …