"python3 -m http.server" is really useful when building simple JavaScript pages, or when you need a simple static file server for testing.
"ss -p" is great, but if you just want to see what's hogging your bandwidth, iftop and nethogs are much better.
My favourite one-liner is "open .", to open the current directory in Finder. The open command can also open URLs and other files.
I also have an alias for "osascript -e 'display notification "'"$1"'"'", which will display the text you choose in a MacOS notification. It's useful when you need to be notified at the end of a long-running task. "printf '\a'" is also useful if you need the terminal to "ding".
For those that don't know "start ." is the Windows version of "open .", opening Explorer in the current folder.
Speaking of Windows, "pushd \\servername\sharename" is a simple way to mount a share in Windows, if you have the login creds cached, and set the new drive letter as your active drive. Useful if you need to bounce around a bunch of shares.
It's not "start" is an alias to "explorer", it's that "start" runs the args through "ShellExecute".
I mention this only because it has some other uses. For instance, Windows apps can install run handlers so that something like Start->Run->Excel will launch Excel. Just running "excel" on a command prompt won't work, but "start excel" will work, since that kicks off the right path.
You can also use something like "start /w filename.txt" to start an instance of your editor, and wait for it to close (well, mostly, some apps do weird things and break this)
Also «open somefile.txt» can open, well, any file or directory, just as if you double clicked it. It works on multiple files, too. And possibly URLs, but I don’t have a mac anymore to check.
A slightly upgraded bash/zsh function for displaying a notification:
noti() {
osascript -e \
'on run argv
display notification (item 1 of argv) with title "Notification"
end run' \
$1
}
# Example:
noti 'Hello world!'
This fixes any escaping issues by passing the notification string to osascript as an argument instead of embedding it in the text of the program (which makes things like quotation marks not work correctly).
Sticking it in your .bashrc or .zshrc will make it available at any time in your shell.
Most Linux based OSes will probably have busybox installed which includes its own web server. This can be nice if you don't have python (or if you think its overkill.)
Not a one-liner by itself, but sticking pbcopy/pbpaste into a pipeline is great for quick text processing. Wish you had regency support in a text field? `pbpaste | sed s/needle/NEEDLE/g | pbcopy`
$ rin +30 Check the turkey
$ rin '14:30 tomorrow' Watch baseball
I currently have it setup so it pops up a modal dialog using Zenity. As well, it uses my cheap-and-cheerful bespoke notification doohickey that I have running in waybar, another script called notify: https://github.com/jvinet/dotfiles/blob/master/bin/notify
This way, I have a nagging badge/icon in my waybar system tray until I finally do check that turkey and watch that baseball.
"python3 -m http.server" is really useful when building simple JavaScript pages, or when you need a simple static file server for testing.
"ss -p" is great, but if you just want to see what's hogging your bandwidth, iftop and nethogs are much better.
My favourite one-liner is "open .", to open the current directory in Finder. The open command can also open URLs and other files.
I also have an alias for "osascript -e 'display notification "'"$1"'"'", which will display the text you choose in a MacOS notification. It's useful when you need to be notified at the end of a long-running task. "printf '\a'" is also useful if you need the terminal to "ding".