TYPICAL COMMANDLINE SESSION [bash] $echo $? 0 $echo $? 0 $exit 10 | tee solve.txt $cat solve.txt $rm solve.txt $exit 10 | echo $? 0 $exit -1 | echo $? 0 $exit -1 | echo $? 0 $false | true $echo $? 0 $false $echo $? 1 $true $echo $? 0 $exit 5 | tee …
Category Archives: operating system
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 …
Continue reading “Indicate how each name would be interpreted if used as a command name”
sort – sort lines of text files
$cat test.txt sept aug jan dec oct apr feb mar11 mar1 $sort test.txt apr aug dec feb jan mar1 mar11 oct sept $sort -M test.txt jan feb mar1 mar11 apr aug sept oct dec $
GNU Diffutils is a package of several programs related to finding differences between files
https://www.computerhope.com/unix/udiff.htm
libevent – an event notification library
http://libevent.org/
chkservice – tool for managing systemd units in terminal
The SIGTERM signal is sent to a process to request its termination
$ps aux | grep nautilus jeffrin 3412 0.4 2.4 839692 96464 ? Sl 18:45 0:12 /usr/bin/nautilus –gapplication-service jeffrin 4714 0.0 0.0 12904 1064 pts/1 S+ 19:35 0:00 grep nautilus $kill -TERM 3412 $ps aux | grep nautilus jeffrin 4722 0.0 0.0 12904 1012 pts/1 S+ 19:36 0:00 grep nautilus $
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 …
Continue reading “grep a file, but show several surrounding lines?”
SynapticsTouchpad
https://wiki.debian.org/SynapticsTouchpad