terminal – How to eject all units from the command line

You can use the built-in AppleScript solution, as mentioned in this thread and on this page, by adding this to ~/.bash_profile:

alias ejectall='osascript -e "tell application "Finder" to eject (every disk whose ejectable is true)"'

This will require you to give the Terminal permission to control Finder, or you will get this error:

execution error: Not authorised to send Apple events to Finder. (-1743)

If you want a cigar bash solution, here is a function that you can call with ejectall. If you renamed your startup disk or have mobile Time Machine backups, you may need to edit the condition that filters the drives.

ejectall() {

    for v in /Volumes/*; do
    if (( $v != *"Macintosh HD" )); then
        echo "Ejecting $v..."
        diskutil eject "$v"

        if ( $? -eq 0 ); then
        ejected=$(($ejected + 1))
        total=$(($total + 1))

    if ( $total -eq 0 ); then
    echo "No drives to eject"
    msg="$ejected drive(s) ejected"
    failed=$(($total - $ejected))
    if ( $failed -gt 0 ); then
       msg="$msg, $failed drive(s) failed to eject"
    echo $msg

root access: how to change the Android lock screen from the Terminal?

What I want to achieve is to change the lock screen, regularly. As an example, the lock screen is a PIN, and the PIN number must be increased by one every day (for example, using cron jobs).

It seems that there is no such application in Google Play Store, as it is a special task (if so, send the link here). The next method would be to use Terminal. My phone is rooted with Termux installed.

Now, the questions are:

  • How to change the lock screen from the Terminal?

  • How to set the type of screen lock? For example, I would say that the screen lock should be changed from a PIN to a pattern. Consider special cases as the pattern, please (if possible or not).

Note: The reasons for doing such a thing are personally preferable, so asking for the benefits of doing so seems useless. Someone else might want to change it just for fun.

Edit: This answer suggests using locksettings I send. However, on my phone (with custom AOKP ROM, Android 7.1.2), it doesn't work.

Terminal and log canonical singularities

Leave $ D $ be a divisor with at most terminal singularities in a soft projective variety $ X $. Is the pair $ (X, D) $ canonical record?

terminal – Search file in Time Machine backup with command line

I am looking for a specific file that starts with "Screenshot 2019-07-11" with an unknown location. I tried:

$ sudo find /Volumes/TimeMachine/ -type f -name 'Screenshot 2019-07-11*'
find: /Volumes/TimeMachine//.Spotlight-V100: Operation not permitted
find: /Volumes/TimeMachine//Backups.backupdb: Operation not permitted

The error led me to this thread, which uses bypass execute a command, so I tried this command and got the same error:

$ sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass find /Volumes/TimeMachine/ -type f -name 'Screenshot 2019-07-11*'
find: /Volumes/TimeMachine//.Spotlight-V100: Operation not permitted
find: /Volumes/TimeMachine//Backups.backupdb: Operation not permitted

How can I search for a file in a Time Machine backup with the command line?

Is there any way to install Gnome Themes with the terminal?

Just like there is a command & # 39; git clone & # 39 ;, is there one for gnome themes that works the same way? How to download the theme in the Downloads folder.

Add a Sanskrit keyboard using the setxkbmap command in the terminal?

I am trying to find an efficient way to write the correct Roman transcript of the Sanskrit characters. This is done using a special keyboard that allows one to write diacritical marks in unicode. Standard diacritical marks for Sanskrit are available in unicode. I can type this very efficiently in OSX on my Macintosh without problems, using a keyboard called "Easy Unicode" created by Toshiya Unebe. Attempts have been made to mimic this for Linux, such as https://garudam.info/sanskrit-transliteration-keyboard-on-linux/, but I have found that this code does not work. There is an IAST unicode keyboard available for use with Ibus, but it is quite defective and seems to cause conflicts. I have tried several solutions over the years, looking for a good option. This is important to me, since I am responsible for editing and translating books in Sanskrit and Bengali. There are keyboard options available to enter these languages ‚Äč‚Äčnatively, but I have always found the best option to enter Roman transliteration as mentioned above. I want to be able to toggle between a Sanskrit transliteration keyboard in English and Romanized. I also tried FCITx and different m17n, but it seems to block and / or create conflicts with Ibus. Thank you very much for any suggestions.

Psql password not known in Mac Terminal

I recently installed PostgreSQL. But I don't know the password. How do I change the password? Thanks in advance!

Save the contents of the Linux terminal * as shown * in the file

used to screen -L to capture the output of a ipython session. ipython It does a lot of mixing of its output to allow overwriting the screen in the terminal, so the file is full of control codes as expected, and these codes are visible and the output cannot be read when the file is displayed in an editor or with more or less.

But nevertheless, cat Y head it processes the control codes and, therefore, the view in the terminal is "correct", as it resembles the output of the original session.

What I would like to do is capture the text as shown in the terminal when I cat the file. Obviously cat file > newfile It will simply copy the file with the control codes intact.

Things I have tried:

  • script It also captures control codes.
  • less -R still confused
  • less -r makes the terminal ring completely

Open pdf about ssh on Mac terminal

As the title says, I do

> ssh user@host.de 
> cd documents/ 
> okular example.pdf 
QXcbConnection: Could not connect to display 
Aborted (core dumped)

I connect to an OpenSUSE machine through SSH from a MAC operating system.

terminal – How to show the position marked at the top when jumping to the previous mark in iTerm?

When you jump to an earlier mark in iTerm, the marked position will be displayed (vertically) in the center of the terminal window.

But instead of showing it in the middle, I want it to be displayed on the top line (at once).
Is there any way to make this possible and how?

environment information:

  • macOS High Sierra 10.13.3
  • iTerm2 Build 3.2.9
  • shell integration enabled