You are not logged in.

#121 2020-07-22 10:36:22

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

alias itisdone='espeak "It is Done!" >/dev/null 2>&1'

Quite often I perform a time-intensive task and want to know when it's finished. Instead of typing the espeak command out every time, I made it an alias.

Example:

sudo dd if=/fantastic/new/BL.iso of=/dev/sdX bs=4M; sync; itisdone

Offline

#122 2020-07-22 12:53:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Handy command-line stuff for terminals or scripts

^ Ingenious smile  I do a similar thing using a desktop notification.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#123 2020-07-22 15:30:16

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

^ Not enough when I'm in the kitchen!

Offline

#124 2020-07-22 17:42:54

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Handy command-line stuff for terminals or scripts

I would not hear it in the kitchen, computer is upstairs.

But something similar to my little (?) backup script using rsync

The ending:

echo "    Syncing /media/11/"
echo "      to /media/sector11/disk/M11/"
 rsync -avh --progress --delete --delete-excluded --exclude-from '/home/sector11/bin/rsync_m11_exclude.txt' /media/11/ /media/sector11/disk/M11 > "/home/sector11/.s11bk-logs/M11_$(date +%Y·%m·%d·%H·%M·%S).txt"


sleep 10s &&
echo ""
echo "1. Syncing Complete"
read -p "2. Unmount /media/sector11/disk? (Y|n) " yn
case $yn in
[Yy]* )  ;;
[Nn]* ) echo "    /media/sector11/disk still mounted" && exit;;
esac
echo "    Unmounting /media/sector11/disk,"
umount /media/sector11/disk/
echo "    wait until the blue light"
echo "    stops flashing and the terminal prompt"
sleep 5s &&
echo " To remove a directory"
echo " use r m command: -f -r /media/sector11/disk/S11-MONTH"
echo " "
exit

IF I go to the kitchen, it's waiting for me when I get back.  big_smile

Not originally my idea; adopted and tweaked from other sources.
2020-07-22-143901-S11.jpg


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#125 2020-07-23 02:14:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,560
Website

Re: Handy command-line stuff for terminals or scripts

I think audio reminders (eg with espeak) are cool. They seem to reach the brain over a different channel, so - for me anyway - they're less distracting than visual popups but the message still gets through.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#126 2020-07-23 06:17:46

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

^ True. I often find myself having dismissed a notification without it having reached my brain.
Like when xfce4-power-manager tells me that my battery is low. Why can't it be set to urgency=critical at least?

Offline

#127 2020-07-23 06:24:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,560
Website

Re: Handy command-line stuff for terminals or scripts

^I can't remember ever having got a low-battery warning in time to do anything useful before the laptop shut itself down. neutral


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#128 2020-07-23 13:44:10

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Handy command-line stuff for terminals or scripts

No laptop - no battery warning.

Mine just sits in the terminal.
Come back from the kitchen with my coffee, and read it.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#129 2020-07-25 11:09:04

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

Not sure it's "handy", but I found it interesting:

sudo dd if=/dev/mem bs=2048 count=1000 | strings -16

will show you what interesting strings are in your memory (first 2MB if my calculations are correct).
The first 5 lines on mine:

Missing operating system.
Multiple active partitions.
Operating system load error.
IBM VGA Compatible BIOS.
For Evaluation Use Only.

Evaluation use only? Weird.
After that it starts getting device specific.

From this article: Understanding the /dev directory

Offline

#130 2020-07-26 06:46:22

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,560
Website

Re: Handy command-line stuff for terminals or scripts

^That's fun. This worked too:

sudo strings -16 /dev/mem | less
00IBM VGA Compatible BIOS. 
For Evaluation Use Only.
$VBT HASWELL        d
BIOS_DATA_BLOCK 
2180Intel(R) HSW Mobile/Desktop PCI Accelerated SVGA BIOS
DECOMPILATION OR DISASSEMBLY PROHIBITED
Copyright (C) 2000-2011 Intel Corp. All Rights Reserved.

Again that odd evaluation comment. XdcAYOB.gif


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#131 2020-07-26 09:19:50

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

johnraff wrote:

Again that odd evaluation comment.

I think the BIOS (?) stores all possible strings it can display on screen, even if it doesn't apply to the current situation. Seems oddly wasteful to me, but what's a few bytes to a few GB... Also they hardcoded the dot at the end of each sentence 8)
BTW, the -16 option just filters out shorter (and usually not representing human words) strings. Change or remove that option, there's much more.

Offline

#132 2020-07-26 09:48:08

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,560
Website

Re: Handy command-line stuff for terminals or scripts

^Yeh I checked 'man strings'. I've used it often before, but never with any options.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#133 2020-07-26 12:47:56

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Handy command-line stuff for terminals or scripts

yes, taking the -16 out gets a LOT.

Interesting that I get no:

For Evaluation Use Only.

It must me an IBM thing:

 761295520
04/25/19,05:49:18
113-PICASSO-115
RAVEN
PCI_EXPRESS
PICASSO Generic VBIOS                                                       
(C) 1988-2010, Advanced Micro Devices, Inc.
ATOMBIOSBK-AMD VER016.002.000.010.000000
PicassoGener
17742501
457094  
        
AMD_PICASSO_GENERIC\config.h
ATOM
PCIR
AMD ATOMBIOS

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#134 2020-09-03 11:02:18

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,741

Re: Handy command-line stuff for terminals or scripts

Something to minimize.this.urxvt.window

alias hide="xdotool windowminimize $(xdotool getactivewindow)"

Last edited by brontosaurusrex (2020-09-03 11:02:31)

Offline

#135 2020-09-03 13:28:30

vasa1
Member
Registered: 2015-09-29
Posts: 204

Re: Handy command-line stuff for terminals or scripts

brontosaurusrex wrote:

Something to minimize.this.urxvt.window

alias hide="xdotool windowminimize $(xdotool getactivewindow)"

Why not just use your window manager's shortcut? Many, including Openbox, use `Alt+Spacebar, N`. Kwin uses `Alt+F3, N`.


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

#136 2020-09-03 16:46:29

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,741

Re: Handy command-line stuff for terminals or scripts

In my case: I tend to mouse/tint2 to minimize, but urxvt windows have no decorations. And I have no memory that alt+i seems to be shortkey for minimize...., so an alternative I guess.^

Offline

#137 2020-09-05 07:26:01

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

^ try what vasa1 said: "Alt+Spacebar, N" - it should work without decorations, too. It's two keystrokes less than "hide<Enter>" big_smile

Offline

#138 2020-09-05 08:49:35

vasa1
Member
Registered: 2015-09-29
Posts: 204

Re: Handy command-line stuff for terminals or scripts

ohnonot wrote:

^ try what vasa1 said: "Alt+Spacebar, N" - it should work without decorations, too. It's two keystrokes less than "hide<Enter>" big_smile

Changing the alias to "hd", assuming "hd" is available, would get over that wink


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

#139 2020-09-12 05:35:19

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,560
Website

Re: Handy command-line stuff for terminals or scripts

When an executable you just put in ~/bin isn't being run.
Sometimes 'which' pretends it's there, but the system doesn't yet know about it. Maybe the old path (eg /usr/bin/file) is cached somewhere. Use 'hash' to refresh the path:

$ which myexec
/usr/bin/myexec
$ cp myexec ~/bin
$ chmod +x ~/bin/myexec
$ which myexec
/home/john/bin/myexec
### but it's a lie!
### /usr/bin/myexec is still being invoked
$ hash myexec
### now it works

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#140 2020-09-12 21:47:12

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Handy command-line stuff for terminals or scripts

^ good to know!
I usually just close/open the terminal...

Offline

Board footer

Powered by FluxBB