[PC Hardware for Linux Developers] OfficerJimLahey:
Functions/Scripts in Detail

cdb

Performs a search (based on name) below the current working directory to change to any specified matched directory. As this uses a live search, you may not want to use this when then there is a very deep directory structure below, or you will find yourself waiting on the search results.

joel@cybaryme ~/B/g/android_kernel_asus_msm8916> cdb arm
a 1) ./virt/kvm/arm
b 2) ./arch/arm
c 3) ./Documentation/devicetree/bindings/arm
d 4) ./Documentation/arm
e 5) ./Documentation/zh_CN/arm
f 6) ./sound/arm
g 7) ./tools/perf/arch/arm
h 8) ./drivers/scsi/arm
Select directory by letter or number: 2
joel@cybaryme ~/B/g/a/a/arm>

cdfl

Move anywhere in the filesystem without having to type out or tab through a full path - enter the first letter of every path level instead. '~' and '/' can be used as a prefix (to start with home or root, respectively), or use '.' anywhere in the parameter to go up one level.

joel@cybaryme /u/l/bin> cdfl ~B.
joel@cybaryme ~> cdfl .
joel@cybaryme /home> cd
joel@cybaryme ~> cdfl Bg
a 1) ./Build/github
b 2) ./Build/genymotion
c 3) ./Build/git:
Select directory by letter or number: 1
joel@cybaryme ~/B/github> cdfl ..
joel@cybaryme ~> cdfl /ulb
a 1) /usr/lib/blt2.5
b 2) /usr/lib/binfmt-support
c 3) /usr/lib/binfmt.d
d 4) /usr/local/bin
Select directory by letter or number: 4
joel@cybaryme /u/l/bin>

cdh

Displays a history of visited directories to allow changing back to one of them.

joel@cybaryme ~/B/g/a/a/arm> cdh
c 3) ~/Build
b 2) ~
a 1) ~/Build/github/android_kernel_asus_msm8916
Select directory by letter or number: 3
joel@cybaryme ~/Build> cdh
d 4) ~/Build
c 3) ~
b 2) ~/Build/github/android_kernel_asus_msm8916
a 1) ~/Build/github/android_kernel_asus_msm8916/arch/arm
Select directory by letter or number: 3
joel@cybaryme ~>

clihelp

A helper message about common keyboard shortcuts. Can also be invoked by pressing ^h (CTRL + H)

joel@cybaryme ~> clihelp

Keyboard Shortcuts:
CTRL + C – Cancels current command
CTRL + S – Repeats the last command with sudo
CTRL + L – Provide directory listing in current working directory
CTRL + U – Cuts text up until the cursor
CTRL + K – Cuts text from the cursor until the end of the line
CTRL + W – Cut word behind cursor
CTRL + Y – Pastes text
CTRL + E – Move cursor to end of line
CTRL + A – Move cursor to the beginning of the line
ALT + Backspace – Delete previous word
CTRL + Left – Move cursor one word to the left
CTRL + Right – Move cursor one word to the right
Home – Move cursor to beginning of line
End – Move cursor to end of the line
Tab – Autocomplete current command/argument

joel@cybaryme ~>

dirw

A compact listing of the current directory with colour. Long names are truncated in the listing. Can also be invoked by pressing ^l (CTRL + L)

joel@cybaryme ~/B/g/android_kernel_asus_msm8916> dirw
android/	AndroidKernel.mk	arch/	block/
COPYING	CREDITS	crypto/	Documentation.../
drivers/	firmware/	fs/	include/
init/	ipc/	Kbuild	Kconfig
kernel/	lib/	MAINTAINERS	Makefile*
mm/	net/	README	REPORTING-BUGS
samples/	scripts/	security/	sound/
tools/	usr/	virt/
joel@cybaryme ~/B/g/android_kernel_asus_msm8916>

dirlast / dirprev / actlast / actprev

These functions either display or act (copy, move or remove) upon files that match a certain age (modified date), whether they are newer than a specific week/day/hour/minute (dirlast/actlast) or older (dirprev/actprev). The searches can also include a (wildcarded) name search as well.

joel@cybaryme ~/B/g/cli-productivity-config> dirlast D 5 '*.fish' -rl
-rw-r--r-- 1 joel joel 2850 Sep 1 17:53 ./fish/functions/dir-core.fish
-rw-r--r-- 1 joel joel 50 Sep 1 17:05 ./fish/functions/actlast.fish
-rw-r--r-- 1 joel joel 3826 Sep 1 17:53 ./fish/functions/act-core.fish
-rw-r--r-- 1 joel joel 50 Sep 1 17:13 ./fish/functions/dirprev.fish
-rw-r--r-- 1 joel joel 50 Sep 1 17:15 ./fish/functions/dirlast.fish
-rw-r--r-- 1 joel joel 50 Sep 1 17:12 ./fish/functions/actprev.fish
-rw-r--r-- 1 joel joel 2634 Sep 4 09:25 ./fish/functions/cdh.fish
joel@cybaryme ~/B/g/cli-productivity-config> actprev W 2 cp ..
Action: cp
The following files will be affected:
./README.md
./INSTALL-fish.sh*
./LICENSE
./INSTALL-Bash.sh*
Do you wish to continue? [yes|no]: y
joel@cybaryme ~/B/g/cli-productivity-config>

editadd

Opens a file in your default editor, and then marks it for inclusion in the next git commit ('git status' is also run to verify the addition).

joel@cybaryme ~/B/g/cli-productivity-config> editadd Bash/.bash_functions
M Bash/.bash_functions
joel@cybaryme ~/B/g/cli-productivity-config>

mked

Makes and enters a specified directory (or several nested ones when applicable).

joel@cybaryme ~/B/g/cli-productivity-config> mked examples/Bash
joel@cybaryme ~/B/g/c/e/Bash>

sudo!!

Repeats the last command, with sudo preceeded. In bash, this already exists as 'sudo !!'. Can also be invoked in either shell by pressing ^s (CTRL + S)

joel@cybaryme ~> apt-get update
Reading package lists... Done
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
joel@cybaryme ~> sudo!!
[sudo] password for joel:
Ign:1 http://mirror.its.dal.ca/debian jessie InRelease
Ign:2 http://mirror.its.dal.ca/debian stretch InRelease
Hit:3 http://mirror.its.dal.ca/debian stretch-updates InRelease
Hit:4 http://mirror.its.dal.ca/debian jessie-backports InRelease
Hit:5 http://mirror.its.dal.ca/debian jessie Release
Hit:6 http://mirror.its.dal.ca/debian stretch Release
...

timer

A cut down 'time' command showing only the "wall clock" time a command has run for.

joel@cybaryme ~> timer sleep 1
Ran for 0:01.00 min:sec
joel@cybaryme ~>

wakessh

Invokes Wake-On-LAN (WOL) for a PC defined by a profile, then remotes into the system once online.

joel@cybaryme ~> wakessh android
192.168.1.111 not turned on. WOL packet sent at 19:23
Waiting a Minute...
Trying again.....
192.168.1.111 is UP as on 19:24
Attempting to SSH android@192.168.1.111...
Linux terminatrix 4.14.0-0.bpo.3-amd64 #1 SMP Debian 4.14.13-1~bpo9+1 (2018-01-14) x86_64

Last login: Sat Mar 10 11:33:38 2018 from 192.168.1.101
android@terminatrix:~$